zincware / MDSuite

A post-processing engine for particle simulations
https://mdsuite.readthedocs.io/
Eclipse Public License 2.0
36 stars 7 forks source link

update_user_args in NernstEinsteinIonicConductivity #604

Open okunoyukihiro2 opened 9 months ago

okunoyukihiro2 commented 9 months ago

Dear Developers

I begun to use MDSuite, and analyzed the ion conductivity from the lammps trajectory like,

ion_ne = LiTFSI_H2O_experiment.run.NernstEinsteinIonicConductivity(species=['Li'],data_range=5000)

Then, we got an error

~/anaconda3/lib/python3.8/site-packages/mdsuite/calculators/nernst_einstein_ionic_conductivity.py in call(self, corrected, plot, data_range, export, species, save) 95 if true, save the output. 96 """ ---> 97 self.update_user_args(plot=plot, save=False, data_range=data_range, export=export) 98 self.corrected = corrected 99 self.data = self._load_data() # tensor_values to be read in

AttributeError: 'NernstEinsteinIonicConductivity' object has no attribute 'update_user_args'

I searched method "update_user_args" in the source codes, but I could not find it.

Is it possible to comment out the corresponding line "self.update_user_args(plot=plot, save=False, data_range=data_range, export=export)" ?

And, if possible, I want to know how to add charge information to each elemental species later in MDSuite.

Sincerely,

Yukihiro Okuno.

SamTov commented 9 months ago

Hi @okunoyukihiro2, it looks like the NE conductivity has been missed in an API update. That is strange. We will get started working on that as it should be fixed quickly.

You certainly can try to uncomment this line as it should not cause any large problems, but that isn't always the best thing to do. What I would rather suggest, is to take your self-diffusion coefficients and compute this property by hand as it is relatively simple with just a sum over the diffusion coefficients.

You can update charge information after the project and experiment is loaded with the following:

md_project.experiments.NaCl.species["Na"].charge = 1
md_project.experiments.NaCl.species["Cl"].charge = -1
md_project.experiments.KCl.species["K"].charge = 1
md_project.experiments.KCl.species["Cl"].charge = -1

As an additional comment here, when it comes to charged systems, it is not usually advisable to use nernst einstein alone as it neglects correlation effects.

okunoyukihiro2 commented 9 months ago

Dear SamTov

Thank you for always answering my questions.

I commented the corresponding line temporary.

Actually, I started using MDSuite to evaluate diffusion coefficients with correlation effects and to calculate Haven's ratio of ion mobility.

In order to evaluate the true diffusion coefficient with correlation, should I use GreenKuboDiffusionCoefficient or Einstein_distinct_diffusion_coefficients for all species ?

Sincerely.

SamTov commented 9 months ago

Hi, sorry for the delayed response. If you want to use correlation functions then you need the GreenKubo approach, the Einstein method uses an MSD. If you have the data and computing power, I am personally always inclined toward the GK approach.

One point I would like to make is that the distinct coefficients are quite experimental. We don't have analytical test data in this case and so you should approach it carefully and make sure your results are making sense to you.

okunoyukihiro2 commented 9 months ago

Thank you for your responce. I have always been helped by your advice. Sorry, let me just confirm one thing. On the ”diffusion” coefficient (not ion conductivity), GreenKuboDiffusionCoefficients in MDSuite include correlation effect other than 'self-diffusion' calculated from MSD? I want to Haven ration of diffusion coefficient and if GreenKuboDiffusionCoefficient include correlation effect from other ions, I will use GreenKuboDiffusionCoefficient for total diffusion coefficient.

Sincerely, Yukihiro Okuno

SamTov commented 9 months ago

GreenKuboDiffusion is a self diffusion coefficient and GreeKuboDistinct is the distinct diffusion (correlation coefficient). If you wanted the full diffusion value you would need to add these together, along with some coefficient in the case of the cross species terms.

okunoyukihiro2 commented 9 months ago

Thank you for your kind reply. I will try to use GreenKuboDistinct. Sincerely.

Yukihiro Okuno.

okunoyukihiro2 commented 7 months ago

Dear Dr. DamTov. Sorry for asking so many questions over time. I want to calculate total diffusion by self-diffusion and distinct diffusion, and I am looking for an equation that relates the total diffusion coefficient by self-diffusion distinct-diffusion. If possible, can you introduce me to any papers that you used as references when implementing velocity-cross auto correlation function and distinct diffusion coefficient in the MD-Suite?

Sincerely, Yukihiro Okuno

SamTov commented 6 months ago

Hey Yukihiro, sorry for the late reply! You can check out the paper by Kashyap: https://pubs.acs.org/doi/abs/10.1021/jp204182c which has a full derivation in the SI. But to be honest, the best thing to do would be to try it yourself. Just take the standard GK relation for ionic conductivity and substitute in the expression for ionic charge, the sum over atom velocities multiplied with their charges. You cn then group terms by their atomic species and see that you get simple expansions over different species terms.

If you do it this way, you will get a good understanding of how the computations work.