cmelab / ptb7-itic

Place to work collaboratively on performing structure and charge transport analysis for PTB7 and ITIC systems
0 stars 5 forks source link

Calcualte static structure factor from freud diffraction pattern results #4

Open chrisjonesBSU opened 3 years ago

chrisjonesBSU commented 3 years ago

Now that freud can give us a diffraction pattern, lets work on creating a tool that can generate the structure factor from the raw data of these patterns.

The cmeutils repo has the code that does this, we just need to go pick it out and implement it with the output of freud's diffract module.

The freud repo does have an open issue for this, but who knows when or if that will be merged in. Until then, this is something we should be able to do ourselves and is an important next step in the ptb7 and itic analysis.

Ultimately, I think this work flow would be very similar to what needs to be done for #3

chrisjonesBSU commented 3 years ago

It looks like the relevant bit of code from the cme_utils repo is in the file diffractometer.py on line 191

    def structure_factor(self, p): 
        a_sort = p.flat[self.idx]
        cs = numpy.cumsum(a_sort,dtype=float)
        cs = cs[self.jumps]
        cs = cs[1:] - cs[:-1]
        cs /= self.nb
        cs = numpy.insert(cs,0,numpy.log10(self.top)) #if we're not taking log of dp, insert a 1.0 instead of 0
        self.asq+=cs
        return cs

So, I think the next steps are the following:

  1. Dig around diffractometer.py a little bit more so we understand what some of these variables are. This includes p, jumps, nb top

  2. Look at the freud diffractometer docs and code and see exactly what of the above variables is accessible through their diffractometer module.