Closed awiddess-ccdc closed 1 year ago
Looks like it ought to be doable, mol2 format has a @<TRIPOS>CRYSIN
type record, which I don't think is currently parsed, but could be used to construct the Structure.unitCell
attribute.
Would be a case of implementing something like the PDB parser: The CRYST1 record is parsed here: https://github.com/nglviewer/ngl/blob/172cfb8fac5377f81b7356f78a2e69f58cb1d0fb/src/parser/pdb-parser.ts#L587-L624
And the resulting object used to populate the unitCell attribute https://github.com/nglviewer/ngl/blob/172cfb8fac5377f81b7356f78a2e69f58cb1d0fb/src/parser/pdb-parser.ts#L686-L690
Then finally: https://github.com/nglviewer/ngl/blob/172cfb8fac5377f81b7356f78a2e69f58cb1d0fb/src/parser/pdb-parser.ts#L704
Would be a nice addition!
@awiddess-ccdc - do you have an example mol2 file with the unit cell parameters in?
Happy New Year Fred, here is an example of a MOL generated from CCDC (I've had to rename the file to a supported file type) ADEHUO.txt
Thanks for that. Having a quick look, the mol2 spec (google "mol2 crysin") says the CRYSIN line contains:
cell cell cell cell cell cell space_grp setting
With:
I can't dig up any other reference to the "setting" - do you have any clues?
Very quick bit of code but hope this helps
export const spaceGroupLookup: string[][] = [
["P 1", "", "", "", "", ""],
["P -1", "", "", "", "", ""],
["P 2", "", "P 1 1 2", "", "", ""],
["P 21", "", "P 1 1 21", "", "", ""],
["C 2", "A 2", "B 1 1 2", "A 1 1 2", "", ""],
["P m", "", "P 1 1 m", "", "", ""],
["P c", "P a", "P 1 1 b", "P 1 1 a", "", ""],
["C m", "A m", "B 1 1 m", "A 1 1 m", "", ""],
["C c", "A a", "B 1 1 b", "A 1 1 a", "", ""],
["P 2/m", "", "P 1 1 2/m", "", "", ""],
["P 21/m", "", "P 1 1 21/m", "", "", ""],
["C 2/m", "A 2/m", "B 1 1 2/m", "A 1 1 2/m", "", ""],
["P 2/c", "P 2/a", "P 1 1 2/b", "P 1 1 2/a", "", ""],
["P 21/c", "P 21/a", "P 1 1 21/b", "P 1 1 21/a", "", ""],
["C 2/c", "A 2/a", "B 1 1 2/b", "A 1 1 2/a", "", ""],
["P 2 2 2", "", "", "", "", ""],
["P 2 2 21", "P 21 2 2", "P 2 21 2", "", "", ""],
["P 21 21 2", "P 2 21 21", "P 21 2 21", "", "", ""],
["P 21 21 21", "", "", "", "", ""],
["C 2 2 21", "A 21 2 2", "B 2 21 2", "", "", ""],
["C 2 2 2", "A 2 2 2", "B 2 2 2", "", "", ""],
["F 2 2 2", "", "", "", "", ""],
["I 2 2 2", "", "", "", "", ""],
["I 21 21 21", "", "", "", "", ""],
["P m m 2", "P 2 m m", "P m 2 m", "", "", ""],
["P m c 21", "P 21 m a", "P b 21 m", "P m 21 b", "P c m 21", "P 21 a m"],
["P c c 2", "P 2 a a", "P b 2 b", "", "", ""],
["P m a 2", "P 2 m b", "P c 2 m", "P m 2 a", "P b m 2", "P 2 c m"],
["P c a 21", "P 21 a b", "P c 21 b", "P b 21 a", "P b c 21", "P 21 c a"],
["P n c 2", "P 2 n a", "P b 2 n", "P n 2 b", "P c n 2", "P 2 a n"],
["P m n 21", "P 21 m n", "P n 21 m", "P m 21 n", "P n m 21", "P 21 n m"],
["P b a 2", "P 2 c b", "P c 2 a", "", "", ""],
["P n a 21", "P 21 n b", "P c 21 n", "P n 21 a", "P b n 21", "P 21 c n"],
["P n n 2", "P 2 n n", "P n 2 n", "", "", ""],
["C m m 2", "A 2 m m", "B m 2 m", "", "", ""],
["C m c 21", "A 21 m a", "B b 21 m", "B m 21 b", "C c m 21", "A 21 a m"],
["C c c 2", "A 2 a a", "B b 2 b", "", "", ""],
["A m m 2", "B 2 m m", "C m 2 m", "A m 2 m", "B m m 2", "C 2 m m"],
["A b m 2", "B 2 c m", "C m 2 a", "A c 2 m", "B m a 2", "C 2 m b"],
["A m a 2", "B 2 m b", "C c 2 m", "A m 2 a", "B b m 2", "C 2 c m"],
["A b a 2", "B 2 c b", "C c 2 a", "A c 2 a", "B b a 2", "C 2 c b"],
["F m m 2", "F 2 m m", "F m 2 m", "", "", ""],
["F d d 2", "F 2 d d", "F d 2 d", "", "", ""],
["I m m 2", "I 2 m m", "I m 2 m", "", "", ""],
["I b a 2", "I 2 c b", "I c 2 a", "", "", ""],
["I m a 2", "I 2 m b", "I c 2 m", "I m 2 a", "I b m 2", "I 2 c m"],
["P m m m", "", "", "", "", ""],
["P n n n", "", "", "", "", ""],
["P c c m", "P m a a", "P b m b", "", "", ""],
["P b a n", "P n c b", "P c n a", "", "", ""],
["P m m a", "P b m m", "P m c m", "P m a m", "P m m b", "P c m m"],
["P n n a", "P b n n", "P n c n", "P n a n", "P n n b", "P c n n"],
["P m n a", "P b m n", "P n c m", "P m a n", "P n m b", "P c n m"],
["P c c a", "P b a a", "P b c b", "P b a b", "P c c b", "P c a a"],
["P b a m", "P m c b", "P c m a", "", "", ""],
["P c c n", "P n a a", "P b n b", "", "", ""],
["P b c m", "P m c a", "P b m a", "P c m b", "P c a m", "P m a b"],
["P n n m", "P m n n", "P n m n", "", "", ""],
["P m m n", "P n m m", "P m n m", "", "", ""],
["P b c n", "P n c a", "P b n a", "P c n b", "P c a n", "P n a b"],
["P b c a", "", "P c a b", "", "", ""],
["P n m a", "P b n m", "P m c n", "P n a m", "P m n b", "P c m n"],
["C m c m", "A m m a", "B b m m", "B m m b", "C c m m", "A m a m"],
["C m c a", "A b m a", "B b c m", "B m a b", "C c m b", "A c a m"],
["C m m m", "A m m m", "B m m m", "", "", ""],
["C c c m", "A m a a", "B b m b", "", "", ""],
["C m m a", "A b m m", "B m c m", "B m a m", "C m m b", "A c m m"],
["C c c a", "A b a a", "B b c b", "B b a b", "C c c b", "A c a a"],
["F m m m", "", "", "", "", ""],
["F d d d", "", "", "", "", ""],
["I m m m", "", "", "", "", ""],
["I b a m", "I m c b", "I c m a", "", "", ""],
["I b c a", "", "I c a b", "", "", ""],
["I m m a", "I b m m", "I m c m", "I m a m", "I m m b", "I c m m"],
["P 4", "C 4", "", "", "", ""],
["P 41", "C 41", "", "", "", ""],
["P 42", "C 42", "", "", "", ""],
["P 43", "C 43", "", "", "", ""],
["I 4", "F 4", "", "", "", ""],
["I 41", "F 41", "", "", "", ""],
["P -4", "C -4", "", "", "", ""],
["I -4", "F -4", "", "", "", ""],
["P 4/m", "C 4/m", "", "", "", ""],
["P 42/m", "C 42/m", "", "", "", ""],
["P 4/n", "C 4/a", "", "", "", ""],
["P 42/n", "C 42/a", "", "", "", ""],
["I 4/m", "F 4/m", "", "", "", ""],
["I 41/a", "F 41/d", "", "", "", ""],
["P 4 2 2", "C 4 2 2", "", "", "", ""],
["P 4 21 2", "C 4 2 21", "", "", "", ""],
["P 41 2 2", "C 41 2 2", "", "", "", ""],
["P 41 21 2", "C 41 2 21", "", "", "", ""],
["P 42 2 2", "C 42 2 2", "", "", "", ""],
["P 42 21 2", "C 42 2 21", "", "", "", ""],
["P 43 2 2", "C 43 2 2", "", "", "", ""],
["P 43 21 2", "C 43 2 21", "", "", "", ""],
["I 4 2 2", "F 4 2 2", "", "", "", ""],
["I 41 2 2", "F 41 2 2", "", "", "", ""],
["P 4 m m", "C 4 m m", "", "", "", ""],
["P 4 b m", "C 4 m b", "", "", "", ""],
["P 42 c m", "C 42 m c", "", "", "", ""],
["P 42 n m", "C 42 m n", "", "", "", ""],
["P 4 c c", "C 4 c c", "", "", "", ""],
["P 4 n c", "C 4 c n", "", "", "", ""],
["P 42 m c", "C 42 c m", "", "", "", ""],
["P 42 b c", "C 42 c b", "", "", "", ""],
["I 4 m m", "F 4 m m", "", "", "", ""],
["I 4 c m", "F 4 m c", "", "", "", ""],
["I 41 m d", "F 41 d m", "", "", "", ""],
["I 41 c d", "F 41 d c", "", "", "", ""],
["P -4 2 m", "C -4 m 2", "", "", "", ""],
["P -4 2 c", "C -4 c 2", "", "", "", ""],
["P -4 21 m", "C -4 m 21", "", "", "", ""],
["P -4 21 c", "C -4 c 21", "", "", "", ""],
["P -4 m 2", "C -4 2 m", "", "", "", ""],
["P -4 c 2", "C -4 2 c", "", "", "", ""],
["P -4 b 2", "C -4 2 b", "", "", "", ""],
["P -4 n 2", "C -4 2 n", "", "", "", ""],
["I -4 m 2", "F -4 2 m", "", "", "", ""],
["I -4 c 2", "F -4 2 c", "", "", "", ""],
["I -4 2 m", "F -4 m 2", "", "", "", ""],
["I -4 2 d", "F -4 d 2", "", "", "", ""],
["P 4/m m m", "C 4/m m m", "", "", "", ""],
["P 4/m c c", "C 4/m c c", "", "", "", ""],
["P 4/n b m", "C 4/a m b", "", "", "", ""],
["P 4/n n c", "C 4/a c n", "", "", "", ""],
["P 4/m b m", "C 4/m m b", "", "", "", ""],
["P 4/m n c", "C 4/m c n", "", "", "", ""],
["P 4/n m m", "C 4/a m m", "", "", "", ""],
["P 4/n c c", "C 4/a c c", "", "", "", ""],
["P 42/m m c", "C 42/m c m", "", "", "", ""],
["P 42/m c m", "C 42/m m c", "", "", "", ""],
["P 42/n b c", "C 42/a c b", "", "", "", ""],
["P 42/n n m", "C 42/a m n", "", "", "", ""],
["P 42/m b c", "C 42/m c b", "", "", "", ""],
["P 42/m n m", "C 42/m m n", "", "", "", ""],
["P 42/n m c", "C 42/a c m", "", "", "", ""],
["P 42/n c m", "C 42/a m c", "", "", "", ""],
["I 4/m m m", "F 4/m m m", "", "", "", ""],
["I 4/m c m", "F 4/m m c", "", "", "", ""],
["I 41/a m d", "F 41/d d m", "", "", "", ""],
["I 41/a c d", "F 41/d d c", "", "", "", ""],
["P 3", "", "", "", "", ""],
["P 31", "", "", "", "", ""],
["P 32", "", "", "", "", ""],
["R 3", "", "", "", "", ""],
["P -3", "", "", "", "", ""],
["R -3", "", "", "", "", ""],
["P 3 1 2", "", "", "", "", ""],
["P 3 2 1", "", "", "", "", ""],
["P 31 1 2", "", "", "", "", ""],
["P 31 2 1", "", "", "", "", ""],
["P 32 1 2", "", "", "", "", ""],
["P 32 2 1", "", "", "", "", ""],
["R 3 2", "", "", "", "", ""],
["P 3 m 1", "", "", "", "", ""],
["P 3 1 m", "", "", "", "", ""],
["P 3 c 1", "", "", "", "", ""],
["P 3 1 c", "", "", "", "", ""],
["R 3 m", "", "", "", "", ""],
["R 3 c", "", "", "", "", ""],
["P -3 1 m", "", "", "", "", ""],
["P -3 1 c", "", "", "", "", ""],
["P -3 m 1", "", "", "", "", ""],
["P -3 c 1", "", "", "", "", ""],
["R -3 m", "", "", "", "", ""],
["R -3 c", "", "", "", "", ""],
["P 6", "", "", "", "", ""],
["P 61", "", "", "", "", ""],
["P 65", "", "", "", "", ""],
["P 62", "", "", "", "", ""],
["P 64", "", "", "", "", ""],
["P 63", "", "", "", "", ""],
["P -6", "", "", "", "", ""],
["P 6/m", "", "", "", "", ""],
["P 63/m", "", "", "", "", ""],
["P 6 2 2", "", "", "", "", ""],
["P 61 2 2", "", "", "", "", ""],
["P 65 2 2", "", "", "", "", ""],
["P 62 2 2", "", "", "", "", ""],
["P 64 2 2", "", "", "", "", ""],
["P 63 2 2", "", "", "", "", ""],
["P 6 m m", "", "", "", "", ""],
["P 6 c c", "", "", "", "", ""],
["P 63 c m", "", "", "", "", ""],
["P 63 m c", "", "", "", "", ""],
["P -6 m 2", "", "", "", "", ""],
["P -6 c 2", "", "", "", "", ""],
["P -6 2 m", "", "", "", "", ""],
["P -6 2 c", "", "", "", "", ""],
["P 6/m m m", "", "", "", "", ""],
["P 6/m c c", "", "", "", "", ""],
["P 63/m c m", "", "", "", "", ""],
["P 63/m m c", "", "", "", "", ""],
["P 2 3", "", "", "", "", ""],
["F 2 3", "", "", "", "", ""],
["I 2 3", "", "", "", "", ""],
["P 21 3", "", "", "", "", ""],
["I 21 3", "", "", "", "", ""],
["P m -3", "", "", "", "", ""],
["P n -3", "", "", "", "", ""],
["F m -3", "", "", "", "", ""],
["F d -3", "", "", "", "", ""],
["I m -3", "", "", "", "", ""],
["P a -3", "", "", "", "", ""],
["I a -3", "", "", "", "", ""],
["P 4 3 2", "", "", "", "", ""],
["P 42 3 2", "", "", "", "", ""],
["F 4 3 2", "", "", "", "", ""],
["F 41 3 2", "", "", "", "", ""],
["I 4 3 2", "", "", "", "", ""],
["P 43 3 2", "", "", "", "", ""],
["P 41 3 2", "", "", "", "", ""],
["I 41 3 2", "", "", "", "", ""],
["P -4 3 m", "", "", "", "", ""],
["F -4 3 m", "", "", "", "", ""],
["I -4 3 m", "", "", "", "", ""],
["P -4 3 n", "", "", "", "", ""],
["F -4 3 c", "", "", "", "", ""],
["I -4 3 d", "", "", "", "", ""],
["P m -3 m", "", "", "", "", ""],
["P n -3 n", "", "", "", "", ""],
["P m -3 n", "", "", "", "", ""],
["P n -3 m", "", "", "", "", ""],
["F m -3 m", "", "", "", "", ""],
["F m -3 c", "", "", "", "", ""],
["F d -3 m", "", "", "", "", ""],
["F d -3 c", "", "", "", "", ""],
["I m -3 m", "", "", "", "", ""],
["I a -3 d", "", "", "", "", ""],
];
export function getSpaceGroup(spacegroup: number, setting: number) {
const spacegroupValue = spaceGroupLookup[spacegroup][setting];
if(spacegroupValue === "") {
throw new Error("Space group not found");
}
return spacegroupValue
}
And here is a example DOPAMN and its spacegroup should be P b c 21
Hi, thanks for the info @thomaspleasance. Neither NGL nor molstar support spacegroup settings. Our tables don't have the data for the HM symbols. I created a ticket (#388) for molstar. You can create packings for mol2 files in molstar as long as the setting is 1.
Here is what your first example looks like in https://molstar.org/viewer for a unitcell. So the packing algorithm needs to be improved but you something. A slice of the supercell view is maybe more informative.
Actually, the packing issue is now fixed thanks to @dsehnal.
Anyway, there is still the limitation that the unitcell is packed on a model level, not per atom as often done for small molecules (https://github.com/molstar/molstar/issues/137).
@awiddess-ccdc The ADEHUO file from you has atoms with names ending in a question mark which also don't have any associated bonds. I have never seen such data. Is it common? How is it usually handled?
@arose these are disorder atoms and will have different positional data for the associated atom preceding any disorder atoms
these are disorder atoms and will have different positional data for the associated atom preceding any disorder atoms
thanks
Using Mol2 is there a way of NGL supporting Packing in a 3x3x3 unit cell?