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

The lammps output file analyzes dipole Angle distribution of water #33

Closed
zdxing1 opened this issue Jan 14, 2024 · 10 comments
Closed

The lammps output file analyzes dipole Angle distribution of water #33

zdxing1 opened this issue Jan 14, 2024 · 10 comments

Comments

@zdxing1
Copy link

zdxing1 commented Jan 14, 2024

Expected behavior

What types of files need to be entered here, and is this due to version problems?

Actual behavior

'''
Warning (from warnings module):
File "D:\python\Lib\site-packages\MDAnalysis\analysis\hbonds\hbond_autocorrel.py", line 52
warnings.warn(wmsg, category=DeprecationWarning)
DeprecationWarning: This module was moved to MDAnalysis.analysis.hydrogenbonds.hbond_autocorrel; hbonds.hbond_autocorrel will be removed in 3.0.0.

Warning (from warnings module):
File "D:\python\Lib\site-packages\MDAnalysis\topology\PDBParser.py", line 331
warnings.warn("Element information is missing, elements attribute "
UserWarning: Element information is missing, elements attribute will not be populated. If needed these can be guessed using MDAnalysis.topology.guessers.
Traceback (most recent call last):
File "D:\桌面\角度分布.py", line 8, in
u = MDAnalysis.Universe(pdb,path)
File "D:\python\Lib\site-packages\MDAnalysis\core\universe.py", line 375, in init
self.load_new(coordinates, format=format, in_memory=in_memory,
File "D:\python\Lib\site-packages\MDAnalysis\core\universe.py", line 580, in load_new
self.trajectory = reader(filename, format=format, **kwargs)
File "D:\python\Lib\site-packages\MDAnalysis\lib\util.py", line 2553, in wrapper
return func(self, *args, **kwargs)
File "D:\python\Lib\site-packages\MDAnalysis\coordinates\DCD.py", line 144, in init
self._file = DCDFile(self.filename)
File "MDAnalysis\lib\formats\libdcd.pyx", line 168, in MDAnalysis.lib.formats.libdcd.DCDFile.cinit
File "MDAnalysis\lib\formats\libdcd.pyx", line 275, in MDAnalysis.lib.formats.libdcd.DCDFile.open
File "MDAnalysis\lib\formats\libdcd.pyx", line 312, in MDAnalysis.lib.formats.libdcd.DCDFile._read_header
OSError: Reading DCD header failed: premature EOF found in DCD file
'''

Code to reproduce the behavior

import waterdynamics
import MDAnalysis
from MDAnalysis.analysis.waterdynamics import AngularDistribution

pdb = '.../OH2.pdb'
path = '.../water.dcd'

u = MDAnalysis.Universe(pdb,path)
selection = "byres name OH2"
bins = 30
AD_analysis = AngularDistribution(u, selection, bins)
AD_analysis.run()
...

Current environment

  • Which version are you using? (run python -c "import waterdynamics; print(waterdynamics.__version__)")
  • Which version of Python (python -V)?
  • Which operating system?
  • What is the output of pip list?
  • If you use conda, what is the output of conda list?
@IAlibay
Copy link
Member

IAlibay commented Jan 14, 2024

@zdxing1 This seems like an issue with the DCD reader, could you confirm what version of MDAnalysis you are using please?

You can do the following to find the version:

import MDAnalysis as mda
print(mda.__version__)

@zdxing1
Copy link
Author

zdxing1 commented Jan 14, 2024

这似乎是 DCD 阅读器的问题,您能否确认您使用的是哪个版本的 MDAnalysis?

您可以执行以下操作来查找版本:

import MDAnalysis as mda
print(mda.__version__)

I'm using version:
MDAnalysis 2.7.0
waterdynamics 1.1.0

@zdxing1
Copy link
Author

zdxing1 commented Jan 15, 2024

@zdxing1 This seems like an issue with the DCD reader, could you confirm what version of MDAnalysis you are using please?

You can do the following to find the version:

import MDAnalysis as mda
print(mda.__version__)

@IAlibay
I'm using version:
MDAnalysis 2.7.0
waterdynamics 1.1.0

@IAlibay
Copy link
Member

IAlibay commented Jan 15, 2024

Thanks @zdxing1 - I don't have the capacity to think this one through yet sorry. Maybe one of the @MDAnalysis/coredevs can weigh in here?

@orbeckst
Copy link
Member

Can you read the DCD file by itself, i.e.

pdb = '.../OH2.pdb'
path = '.../water.dcd'

u = MDAnalysis.Universe(pdb,path)
print(u.trajectory)
for ts in u.trajectory:
   print(ts.frame)

If this fails somewhere then it has nothing to do with waterdynamics.

How did you generate the DCD file?

Are you able to read the DCD file with other tools, e.g., VMD?

@zdxing1
Copy link
Author

zdxing1 commented Jan 16, 2024

Can you read the DCD file by itself, i.e.

pdb = '.../OH2.pdb'
path = '.../water.dcd'

u = MDAnalysis.Universe(pdb,path)
print(u.trajectory)
for ts in u.trajectory:
   print(ts.frame)

If this fails somewhere then it has nothing to do with waterdynamics.

How did you generate the DCD file?

Are you able to read the DCD file with other tools, e.g., VMD?

The dcd file can be imported in vmd, but an error occurred when the pdb file was imported. Is this pdb file the original model's pdb file?
Can pdb files be replaced with other types of files?

@zdxing1
Copy link
Author

zdxing1 commented Jan 16, 2024

Thanks @zdxing1 - I don't have the capacity to think this one through yet sorry. Maybe one of the @MDAnalysis/coredevs can weigh in here?

It's okay. Thanks.

@zdxing1 zdxing1 closed this as completed Jan 16, 2024
@zdxing1
Copy link
Author

zdxing1 commented Jan 16, 2024

Can you read the DCD file by itself, i.e.

pdb = '.../OH2.pdb'
path = '.../water.dcd'

u = MDAnalysis.Universe(pdb,path)
print(u.trajectory)
for ts in u.trajectory:
   print(ts.frame)

If this fails somewhere then it has nothing to do with waterdynamics.

How did you generate the DCD file?

Are you able to read the DCD file with other tools, e.g., VMD?

After modifying the pdb file, it can be opened in vmd and the program can be run. Your example code runs numbers from 0 to 15000. The graph produced by the final program does not have any curves, may I ask what is the problem, and the following is a warning.

D:\python\python.exe D:\桌面\ceshijiaodu.py
D:\python\lib\site-packages\MDAnalysis\analysis\hbonds\hbond_autocorrel.py:52: DeprecationWarning: This module was moved to MDAnalysis.analysis.hydrogenbonds.hbond_autocorrel; hbonds.hbond_autocorrel will be removed in 3.0.0.
warnings.warn(wmsg, category=DeprecationWarning)
D:\python\lib\site-packages\MDAnalysis\topology\PDBParser.py:331: UserWarning: Element information is missing, elements attribute will not be populated. If needed these can be guessed using MDAnalysis.topology.guessers.
warnings.warn("Element information is missing, elements attribute "
D:\python\lib\site-packages\MDAnalysis\coordinates\DCD.py:165: DeprecationWarning: DCDReader currently makes independent timesteps by copying self.ts while other readers update self.ts inplace. This behavior will be changed in 3.0 to be the same as other readers. Read more at MDAnalysis/mdanalysis#3889 to learn if this change in behavior might affect you.
warnings.warn("DCDReader currently makes independent timesteps"
100%|██████████| 15001/15001 [00:06<00:00, 2194.07it/s]
D:\python\lib\site-packages\numpy\lib\histograms.py:885: RuntimeWarning: invalid value encountered in divide

@orbeckst
Copy link
Member

If you can read the DCD file now then you should be able to use the analysis tools.

  • DeprecationWarning: This module was moved to MDAnalysis.analysis.hydrogenbonds.hbond_autocorrel; hbonds.hbond_autocorrel will be removed in 3.0.0.: use MDAnalysis.analysis.hydrogenbonds.hbond_autocorrel instead of MDAnalysis.analysis.hbonds.hbond_autocorrel
  • UserWarning: Element information is missing, elements attribute will not be populated. If needed these can be guessed using MDAnalysis.topology.guessers: If element information is important for your analysis then you should consider providing this information. See e.g. https://docs.mdanalysis.org/stable/documentation_pages/topology/guessers.html#guessing-elements-from-atom-names but ultimately it's your responsibility to provide correct data.
  • DeprecationWarning: DCDReader currently makes independent timesteps by copying self.ts while other readers update self.ts inplace. This behavior will be changed in 3.0 to be the same as other readers. Read more at DCD reader copies timestep while other readers update it.  mdanalysis#3889 to learn if this change in behavior might affect you: See the linked issue #3889 for more information. In your case I don't think it matters because you are only reading the trajectory using standard MDAnalysis tools.

@zdxing1
Copy link
Author

zdxing1 commented Jan 17, 2024

If you can read the DCD file now then you should be able to use the analysis tools.

  • DeprecationWarning: This module was moved to MDAnalysis.analysis.hydrogenbonds.hbond_autocorrel; hbonds.hbond_autocorrel will be removed in 3.0.0.: use MDAnalysis.analysis.hydrogenbonds.hbond_autocorrel instead of MDAnalysis.analysis.hbonds.hbond_autocorrel
  • UserWarning: Element information is missing, elements attribute will not be populated. If needed these can be guessed using MDAnalysis.topology.guessers: If element information is important for your analysis then you should consider providing this information. See e.g. https://docs.mdanalysis.org/stable/documentation_pages/topology/guessers.html#guessing-elements-from-atom-names but ultimately it's your responsibility to provide correct data.
  • DeprecationWarning: DCDReader currently makes independent timesteps by copying self.ts while other readers update self.ts inplace. This behavior will be changed in 3.0 to be the same as other readers. Read more at DCD reader copies timestep while other readers update it.  mdanalysis#3889 to learn if this change in behavior might affect you: See the linked issue #3889 for more information. In your case I don't think it matters because you are only reading the trajectory using standard MDAnalysis tools.

Thank you for your reply.

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

3 participants