Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two Problems In Conductivity Calculation #25

Open
RiverEric opened this issue Dec 1, 2022 · 1 comment
Open

Two Problems In Conductivity Calculation #25

RiverEric opened this issue Dec 1, 2022 · 1 comment

Comments

@RiverEric
Copy link

Hi Mike, thank you for the great code! I met two problems when calculating conductivity.

The first is in calcCond.py, it seems that the function: clacJ(self, jx, jy, jz, dt, tsjump, firstpoint,ver) will never use the variable 'firstpoint', which is the GKC_Skip.

The second one is in calcDiffusivity.py. I got a extreme low conductivity because of one negative diffusivity of component. It seems that the maximum possible value of firststep is the len(lnMSD) -1 ( = len( MSD ) -2 since lnMSD = np.log(MSD[1:]) ). Considering len(Time ) = len(MSD), the number of possible i in line 77( for i in range(int(firststep), len(Time)):) is at least 2, which will make the if statement in line 81( if len(calctime)==1:) never be true. Will it be better if change the for loop to be " for i in range(int(firststep)+1, len(Time)): "?

@mike5603
Copy link
Collaborator

mike5603 commented Dec 2, 2022

I think both of these points are artifacts of how the code has evolved. For the first point, the correlation calculation used to be performed manually, which was significantly more expensive than the current method using fft, so skipping data isn't as important. I suppose if you needed to skip to account for equilibration or something like that, I believe if you add '[firstpoint:]' to all of the jx[l] and similar calls that should handle that. (It's been a while since I've looked at this code so I'm not certain).

For the second case, the len(calctime)==1 test is purely a test to confirm that the msd is long enough to calculate the diffusivity. Again, its been a while since have looked at the code, so I'm not exactly sure what the max value of firststep would be. While PyLAT does attempt to determine the linear region of the MSD for you, it is not perfect so I would always recommend plotting your MSD, especially if you are seeing unexpected values for your diffusivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants