MaginnGroup / PyLAT

GNU General Public License v3.0
101 stars 54 forks source link

Errors on the calculate of viscosity #14

Closed Yongxiancheng closed 3 years ago

Yongxiancheng commented 3 years ago

Thank you for releasing the program.

When I try to test the function of calculating the viscosity, there are several problems. First of all, the files in the directory Examples/Acetonitrile/visc are not accurate. The firle in.visc commented out the dump line which result in the lack of lammpstrj file.

Then, the code in the file PyLAT.sh in the directory Examples/Acetonitrile/visc chooese the LOG—visc.log file instead of default lammps log file—log.lammps. And I also noticed that it is accurate because the log.lammps file would cause some errors.

Finally, I try to run a small system to test the viscosity calculation. I understand that the calculation needs many different trajectories, so this test is just target to verify the function. But different severe errors happened again.

beginning viscosity calculation Traceback (most recent call last): File "../../../pyLAT-master-mol/PyLAT.py", line 331, in output = cv.calcvisc(arg.Visc_Num,arg.Visc_Skip,arg.Visc_Dir,arg.LOG[0],output, arg.verbose, arg.Visc_Samples, arg.Visc_Num_Boots, arg.Visc_Plot, arg.Visc_Guess) File "/share/home/kunyin/chengyongxian/pyLAT-master-mol/src/calcVisc.py", line 45, in calcvisc Log = LammpsLog.from_file(filename) File "/share/home/kunyin/chengyongxian/pyLAT-master-mol/src/viscio.py", line 121, in from_file rawdata = np.genfromtxt(fname=filename,dtype=float,skip_header=header,skip_footer=1) File "/share/apps/python/python3.6.8/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2089, in genfromtxt raise ValueError(errmsg) ValueError: Some errors were detected ! Line #74 (got 2 columns instead of 4) Line #75 (got 3 columns instead of 4) Line #76 (got 7 columns instead of 4) ......

And the attach files are my inp file, data file, the log file, the error output and also the PyLAT.sh file. error.zip

I am really looking forward to it and thank you for your patient and time.

mike5603 commented 3 years ago

The viscosity calculation does not use any information from the trj file, so to save hard drive space I comment out that line. The calculation still works even if it is commented out.

The name of the log file does not matter.

The last part seems to be an issue with the numpy function. Which version of numpy are you using?

Yongxiancheng commented 3 years ago

Thanks for your reply. In fact, there would be some errors if I change visc.log into log.lammps in the file-PyLAT.sh. Traceback (most recent call last): File "../../../PyLAT.py", line 331, in output = cv.calcvisc(arg.Visc_Num,arg.Visc_Skip,arg.Visc_Dir,arg.LOG[0],output, arg.verbose, arg.Visc_Samples, arg.Visc_Num_Boots, arg.Visc_Plot, arg.Visc_Guess) File "/share/home/kunyin/chengyongxian/pyLAT-master-mol/src/calcVisc.py", line 45, in calcvisc Log = LammpsLog.from_file(filename) File "/share/home/kunyin/chengyongxian/pyLAT-master-mol/src/viscio.py", line 117, in from_file if total_lines >= header + md_step/log_save_freq: UnboundLocalError: local variable 'md_step' referenced before assignment

The version of numpy used in the last part is 1.17.4.

mike5603 commented 3 years ago

I pushed a change that should help fix the problem.

A couple of things to note as well:

The code searches for a timestep in you log file, so in general I would include a definition of the timestep in the input file even if you are using the default

The code requires multiple simulations, so I would use at least 5 simulations even if you are just testing it out since it uses a standard deviation between runs in the calculation.

Please test the code out with these things in mind and let me know if it works

Yongxiancheng commented 3 years ago

Thank you for your reminding. After I run 5 simulations to test the viscosity and download the changed file, another error happened as the following: beginning viscosity calculation Traceback (most recent call last): File "../../../PyLAT-master-fix/PyLAT.py", line 331, in output = cv.calcvisc(arg.Visc_Num,arg.Visc_Skip,arg.Visc_Dir,arg.LOG[0],output, arg.verbose, arg.Visc_Samples, arg.Visc_Num_Boots, arg.Visc_Plot, arg.Visc_Guess) File "/share/home/kunyin/chengyongxian/PyLAT-master-fix/src/calcVisc.py", line 45, in calcvisc Log = LammpsLog.from_file(filename) File "/share/home/kunyin/chengyongxian/PyLAT-master-fix/src/viscio.py", line 130, in from_file llog[property] = rawdata[:, column] IndexError: index 13 is out of bounds for axis 1 with size 13 looks like something went wrong when reading files?

mike5603 commented 3 years ago

I think this is related to the Thermo_style definition. The code reads the number of properties from that line, and since you have a comment in that line the code thinks there are more properties. If you remove the comment from that line it should work

Yongxiancheng commented 3 years ago

Thanks a lot. The errors are perfectly solved. Thank you for your assistance again.