Extract the space group generators from Bilbao Crystallographic Server.
hongy...@gmail.com
hongyi.zhao at gmail.com
Fri Jul 15 05:11:36 EDT 2022
On Friday, July 15, 2022 at 11:08:55 AM UTC+8, avi.e... at gmail.com wrote:
> I guess Dan, that he may not be seeing what he is working on as a list of
> lists of lists with each terminal sublist being of cardinality 4. Maybe
> Zhao could look up what methods a list object has that allow you to place
> additional items, such as a list of 4 numbers, at the beginning or end or in
> middle and select a method that does what he wants.
>
> But I have to ask where exactly he wants to place this: "[0, 0, 0, 1]"
Yes. This must be appended to each of the subsists to construct an affine transformation matrix, as described here [1-3].
[1] https://www.cryst.ehu.es/cgi-bin/cryst/programs/nph-doc-trmat
[2] https://www.gap-system.org/Manuals/pkg/crystcat/htm/CHAP001.htm#SECT002
[3] https://www.gap-system.org/Manuals/pkg/cryst/htm/CHAP002.htm
> Unfortunately, we got no before and after picture, just after. I will
> explain what that means at the end but for now, I am making believe what you
> show is the before and see what that would mean.
>
> The list seems to be a representation for a matrix that is 8 by 4 by 4.
> Where do you place just the foursome above just once without breaking the
> matrix? I mean you can extend it at the bottom by adding four of the above
> as in
> [ [0, 0, 0, 1],
> [0, 0, 0, 1],
> [0, 0, 0, 1],
> [0, 0, 0, 1] ]
>
> Or you can take each internal four partner like the first one:
> [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]]
> And extend each one at the right end by adding a fifth:
>
> [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1], [0, 0, 0, 1]]
>
> I can think of other transformations albeit I have no idea why this is being
> done and what makes sense.
>
> So first he needs to be clear on where and what he is adding and then think
> of a method.
>
> And BTW, this problem may also be looked at under a transformation. If
> allowed to use some modules, it might make sense to feed the data structure
> into something that returns a 3-D matrix directly and then use methods that
> allow you to tack on parts of other matrices of various dimensions including
> one. You can then flip it back into nested list format, if you wish.
>
> OK, as mentioned earlier, if this is the AFTER then I have to look and see
> if it is obvious where the "[0, 0, 0, 1]" was placed to make this:
> [[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]],
> [[-1, 0, 0, 1], [0,-1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1]],
> [[-1, 0, 0, 1/2], [0, 1, 0, 1/2], [0, 0,-1, 1], [0, 0, 0, 1]],
> [[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]],
> [[0, 1, 0, 3/4], [1, 0, 0, 1/4], [0, 0, -1, 3/4], [0, 0, 0, 1]],
> [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]],
> [[1, 0, 0, 0], [0, 1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1 ]],
> [[1, 0, 0, 1/2], [0, 1, 0, 0], [0, 0, 1, 1/2], [0, 0, 0, 1]]]
> It looks like you are adding not once copy but eight copies with one each at
> the end of the lists within the main list.
>
> That makes this easy enough so think about what it means to deal with lists
> and NOT matrices.
>
> Your top list contains what I will call an a,b,c,d,e,f,g,h so if you wrote
> code like
>
> Mylist = [ "a", "b", ..., "g", "h"]
>
> Then you can use a loop to iterate over those or perhaps a construct like
> this:
>
> [ item for item in Mylist ]
>
> Wil gather them together and place them back in a list, which is useless but
> it could be something applied to item like changing to upper case. In your
> case, each item will be something like this:
>
> [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0]]
>
> And you want to extend it by attaching this [0, 0, 0, 1]
>
> So how do you attach something to a list? Whatever that method is, call it
> append and look it up and consider a line of code like:
>
> [ item.append(something) for item in Mylist ]
>
> If done right, the above list comprehension loops over one dimension of your
> list version of a matrix and adds [0, 0, 0, 1] to the end and then
> eventually put the a/b/d/..h components back together to look like what I
> THINK you are asking.
>
> You can make some of the other possible changes using other tricks and
> gimmicks like a nested comprehension but at some point, if you work well
> with matrices, you may be better off converting your nested list into a
> numpy matrix and make your addition another matrix and then use
> numpy.concatenate, numpy.vstack and numpy.hstack with proper care with
> multiple dimensions to specify what axis they will combine on.
>
> But doing the full (home)work for you is ...
Thank you for your analysis and comments.
Best,
Zhao
> -----Original Message-----
> From: Python-list <python-list-bounces+avi.e.gross=gmai... at python.org> On
> Behalf Of Dan Stromberg
> Sent: Thursday, July 14, 2022 10:07 PM
> To: hongy... at gmail.com <hongy... at gmail.com>
> Cc: Python List <pytho... at python.org>
> Subject: Re: Extract the space group generators from Bilbao Crystallographic
> Server.
>
> It's good to include what you want to see as output, but it's important to
> also include what you have as input.
>
> It's also good to include what you've coded so far. It's considered good
> etiquette to give it a try yourself before asking the list.
>
> On Thu, Jul 14, 2022 at 1:03 PM hongy... at gmail.com <hongy... at gmail.com>
> wrote:
> > I'm trying to extract the matrix data of "ITA-Setting F d -3 m [origin 1]"
> > listed here [1], and then building an augmented matrix for each of
> > them by adding the last row as "[0, 0, 0, 1]". In short, the following
> > form is the ultimate-desired result:
> >
> > [[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]],
> > [[-1, 0, 0, 1], [0,-1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1]],
> > [[-1, 0, 0, 1/2], [0, 1, 0, 1/2], [0, 0,-1, 1], [0, 0, 0, 1]],
> > [[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]],
> > [[0, 1, 0, 3/4], [1, 0, 0, 1/4], [0, 0, -1, 3/4], [0, 0, 0, 1]],
> > [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]],
> > [[1, 0, 0, 0], [0, 1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1 ]],
> > [[1, 0, 0, 1/2], [0, 1, 0, 0], [0, 0, 1, 1/2], [0, 0, 0, 1]]]
> >
> > Any hints/tips/tricks for achieving this aim will be appreciated.
> >
> > [1]
> > https://www.cryst.ehu.es/cgi-bin/cryst/programs//nph-trgen?gnum=227&wh
> > at=gen&trmat=a-1/8,b-1/8,c-1/8&unconv=F%20d%20-3%20m%20:1&from=ita
> >
> > Regards,
> > Zhao
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list