Open Compizfox opened 1 year ago
Thanks for the bug report! I have an idea of what should be the solution for this but I don't personally have access to some LAMMPS files to test with. Do you have a link to some publically available demo files that I could debug with?
Are you able to share what you use as topology / trajectory? I haven't worked with LAMMPS before, and I can't seem to be able to open the files that you shared without MDAnalysis saying it doesn't recognise the formats. (after unzipping etc)
data.equi
is the topology (data) file, and dump.atom.gz
is the (gzipped) trajectory (dump) file.
I did have to reverse the filename of data.equi
to equi.data
for MDAnalysis was able to recognise it. Oh, and I also encountered the issue that MDAnalysis did not seem to want to open the data file with the pair, bond, and angle coefficients in there (lines 21-42 in the file I sent you), even though that is perfectly valid (so that's a MDAnalysis bug I'd say). After I removed those sections, MDAnalysis was able to open the file.
Sorry, I should have fixed (or at least mentioned) that in the first place...
I am able to get it importing by additionally renaming atoms.dump
to atoms.lammpsdump
which MDAnlaysis now recognises.
In terms of changes to get it importing into MolecularNodes, making the attempt to get element information optional works.
None of the attributes that I currently have set up are imported however, just positions.
Would you expect such a small amount of information? If not, would you be able to provide examples of what information you would expect to be able to extract from the LAMMPS files and what code to use in MDAnalysis?
That looks promising!
Apart from positions, the topology file should also contain bond information. And along with the position data, every particle also has a molecule-id, atom-type, and charge.
For comparison, this is how the same system can look in Ovito with bonds drawn and particles coloured based on atom type:
Okay I've got atom types and bonds importing. You'll have to explain how to extract the molecule-id
and charge
from the MDAnalysis universe because in my testing I wasn't able to figure it out.
Should be simple enough to implement into the import function.
Are you able to explain the atom types
more? Will this numbering be consistent across files? I'm assuming these correspond to some elements somehow?
Great, thanks!
You'll have to explain how to extract the molecule-id and charge from the MDAnalysis universe because in my testing I wasn't able to figure it out.
I've not used MDAnalysis before, so I'll have to look into that.
Are you able to explain the atom types more? Will this numbering be consistent across files? I'm assuming these correspond to some elements somehow?
It's just an arbitrary number number for the type of particle. These are coarse-grained simulations, not atomistic ones, so they don't directly correspond to elements, and are only consistent across files if they are of simulations using the same coarse-grained model.
You'll have to explain how to extract the molecule-id and charge from the MDAnalysis universe because in my testing I wasn't able to figure it out.
I was able to get these out from the AtomGroup attributes:
>>> import MDAnalysis as mda
>>> psf = mda.Universe('/home/lars/Downloads/2022-06-03/equi.data')
>>> psf.atoms.charges
array([0., 0., 0., ..., 0., 0., 0.])
>>> psf.atoms.bonds
<TopologyGroup containing 20000 bonds>
>>> psf.atoms.angles
<TopologyGroup containing 29600 angles>
>>> psf.atoms.resids
array([ 1, 1, 1, ..., 100, 100, 100])
Okay that should be able to be integrated. Would there be a trajectory associated with these files? Multiple timepoints? Do you have an example file if so?
Yes, the trajectory is in the .lammpsdump
file. The one I sent you only contains two timesteps, but it's a trajectory nonetheless ;)
I have just released MolecularNodes 2.3.0, which now enables the parsing of the topology and trajectory files into Blender. You will still have to delete the lines of code that you mentioned above, but alas that is an MDAanlysis issue.
Currently the only imported properties are the res_id
and the atom_types
, along with the XYZ
positions of the atoms which change throughtout the trajectory. The bonds are also imported.
This creates a mesh which has a vertex for each point, and an edge for bond.
So far I haven't created any nodes for handling this data, as it is all non-standard compared to importing atoms etc. You will have to create your own node trees to handle the data for now. I have created an example node tree below:
Which does at least get you started with spheres and bonds:
The animation should also playback as well, moving the atoms and bonds around.
If you can provide a list of things that you would like to do with the data, I can provide more purpose-built LAMMPS nodes, for dealing with this particular kind of data.
I have just released MolecularNodes 2.3.0, which now enables the parsing of the topology and trajectory files into Blender. You will still have to delete the lines of code that you mentioned above, but alas that is an MDAanlysis issue.
Amazing, thanks a lot!
Currently the only imported properties are the
res_id
and theatom_types
, along with theXYZ
positions of the atoms which change throughtout the trajectory. The bonds are also imported.This creates a mesh which has a vertex for each point, and an edge for bond.
So far I haven't created any nodes for handling this data, as it is all non-standard compared to importing atoms etc. You will have to create your own node trees to handle the data for now. I have created an example node tree below:
If you can provide a list of things that you would like to do with the data, I can provide more purpose-built LAMMPS nodes, for dealing with this particular kind of data.
I didn't realise that the workflow for LAMMPS data (once it's imported) would be different from what already exists in Molecular Nodes. Or is it because MolecularNodes is designed with the assumption of operating on atomistic simulations? (LAMMPS is not exclusively for coarse-grained simulations, it can do atomistic ones as well)
In any case, I have zero experience with Blender (or Molecular Nodes) so far, so I'll just give it a try and see if I can get it working.
Just that most of the nodes for displaying atoms & bonds etc assume the existence of atomic_number
, which at least this LAMMPS data doesn't have. I should be able to create some general purpose nodes that don't require it, and can work from atom_type
instead.
Just that most of the nodes for displaying atoms & bonds etc assume the existence of
atomic_number
, which at least this LAMMPS data doesn't have.
Ah, I see.
I should be able to create some general purpose nodes that don't require it, and can work from
atom_type
instead.
That would be perfect, even for atomistic simulations in LAMMPS, since those use the atom_type
attribute as well if I'm not mistaken.
Describe the bug When trying to load a LAMMPS topology (data file) and trajectory, MDAnalysis fails with the errors
This Universe does not contain element information
andThis Universe does not contain name information
.FWIW, the same files open just fine in e.g. Ovito.
To Reproduce
Expected behavior The topology and trajectory to be loaded.
Error Codes
Desktop: