No "timeseries" attribute error in evaluating convergence for a LAMMPSDUMP trajectory

10 views
Skip to first unread message

Amir Sadeghi

unread,
Jun 15, 2022, 11:04:57 AMJun 15
to MDnalysis discussion
Hi everyone,

I tried to follow the steps in Evaluating convergence example for a group of atoms in a LAMMPSDUMP trajectory, but I got the following error.

AttributeError: 'DumpReader' object has no attribute 'timeseries'

This is the code I used:

import MDAnalysis as mda
from MDAnalysis.analysis import encore
from MDAnalysis.analysis.encore.clustering import ClusteringMethod as clm
from MDAnalysis.analysis.encore.dimensionality_reduction import DimensionalityReductionMethod as drm

cell = mda.Universe(
    trj,
    format='LAMMPSDUMP', lammps_coordinate_convention='unscaled',
    atom_style="id type x y z"
)

es_conv = encore.ces_convergence(cell,  # universe
                                  50,  # window size
                                  select='resid 1')  # default


Please see the source code on the GitHub. Do you have any suggestions how I can resolve this error?

MDAnalysis version is 2.1.0.

Thanks,

Amir

Hugo Macdermott-Opeskin

unread,
Jul 23, 2022, 12:39:29 AMJul 23
to MDnalysis discussion
Hi Amir, 

I will confirm with the other devs but from what I can tell this is an issue on our end with the use of a rare API entry point (`trajectory.timeseries`)
for calculating ces. A possible workaround is to use the memoryreader in a slightly convoluted way which I have attached as a jupyter notebook. 

Basically we have to load the trajectory into the MemoryReader (see here)

```
 import MDAnalysis as mda
from MDAnalysis.coordinates.memory import MemoryReader
from MDAnalysis.analysis.base import AnalysisFromFunction
from MDAnalysisTests.datafiles import PDB, XTC

u = mda.Universe(PDB, XTC)

coordinates = AnalysisFromFunction(lambda ag: ag.positions.copy(),
                                   u.atoms).run().results
u2 = mda.Universe(PDB, coordinates['timeseries'], format=MemoryReader)


from MDAnalysis.analysis import encore
from MDAnalysis.analysis.encore.clustering import ClusteringMethod as clm
from MDAnalysis.analysis.encore.dimensionality_reduction import DimensionalityReductionMethod as drm
es_conv = encore.ces_convergence(u2,  # universe

                                  50,  # window size
                                  select='resid 1')

```

If it is an issue I will sort out a fix ASAP but can't make any promises about the timeline. 

Cheers

Hugo 
Reply all
Reply to author
Forward
0 new messages