How to read/load simulation/universe from LAMMPS?

561 views
Skip to first unread message

0x90

unread,
Mar 15, 2018, 12:14:17 AM3/15/18
to MDnalysis discussion
I have this input file:

units lj
dimension
2
boundary p p p
atom_style atomic
neighbor
0.3 bin
neigh_modify every
20 delay 0 check no

lattice hex
0.5
region simbox block
0 100 0 50 -0.1 0.1
create_box
2 simbox

lattice hex
0.5
create_atoms
1 region simbox

lattice hex
0.5 origin 0.5 0.5 0
create_atoms
2 region simbox

mass
1 1
mass
2 1000.0

velocity all create
5 78554
pair_style hybrid lj
/cut 2.5 soft 0.5
pair_coeff
1 1 lj/cut 1.0 1.0 2.5
pair_coeff
1 2 soft 0.5
pair_coeff
2 2 soft 0.5


fix
1 all nvt temp 0.25 0.25 1.0


dump 1 all atom 10 dump.lammpstrj
thermo
200
run
100


The output head will look something like this:


ITEM
: TIMESTEP
0
ITEM
: NUMBER OF ATOMS
20000
ITEM
: BOX BOUNDS pp pp pp
0.0000000000000000e+000 1.5196713713031852e+002
0.0000000000000000e+000 1.3160740129524925e+002
-1.5196713713031854e-001 1.5196713713031854e-001
ITEM
: ATOMS id type xs ys zs
1 1 0 0 0.5
2 1 0.005 0.01 0.5
10001 2 0 0 0.5
10102 2 0.005 0.01 0.5
3 1 0.01 0 0.5
4 1 0.015 0.01 0.5
10002 2 0.01 0 0.5
10104 2 0.015 0.01 0.5
5 1 0.02 0 0.5
6 1 0.025 0.01 0.5
10003 2 0.02 0 0.5


I tried these 2 functions, the first didn't work at all. I am not sure how to work with the object returned from the second option and if it's the right way to go.

u = MDAnalysis.Universe('out.lammps', 'in.lammps', format="LAMMPS")
u = MDAnalysis.topology.LAMMPSParser.DATAParser('out.lammps')

0x90

unread,
Mar 15, 2018, 12:19:17 AM3/15/18
to MDnalysis discussion
One of my problems is that the documentation says the following approach is deprecated:

d=MDAnalysis.topology.LAMMPSParser.DATAParser(trajectory)
d.writePSF("lammps.psf")
d.writePDB("lammps.pdb")
u = MDAnalysis.Unverse("lammps.psf", "lammps.dcd", format="LAMMPS")

Oliver Beckstein

unread,
Mar 15, 2018, 1:51:35 PM3/15/18
to mdnalysis-...@googlegroups.com
Hi 0x90,

It’s been a while since I worked with LAMMPS… so anyone else (Richard, Sean?) please correct me.

1) LAMMPSDataConverter is really old code and it’s not really maintained; ideally it should not be necessary. (But if it works for you, good… just be careful)

2) MDAnalysis cannot parse LAMMPS input “scripts” (such as your input file). It reads DATA files.

3) What format is your output? It does not look like the DATA file http://lammps.sandia.gov/doc/2001/data_format.html (or http://lammps.sandia.gov/doc/read_data.html) . MDAnalysis parses this DATA file format. (If you have a data file then you should be able to do u = mda.Universe(“lamps.data”)  and this should give you both topology information and coordinates.)

I *think* your output is a LAMMPS dump trajectory. If you write it as DCD or XTC instead then you’ll be able to read it in MDA. We don’t have a parser for LAMMPS dump format.

I can’t remember how to create the DATA file, probably http://lammps.sandia.gov/doc/write_data.html – someone with more LAMMPS experience should chime in, please.

(It might be useful to update https://www.mdanalysis.org/docs/documentation_pages/topology/LAMMPSParser.html with the information on how to create DATA files if this is not something that is commonly done in a typical LAMMPS workflow.)

Oliver



--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
To post to this group, send email to mdnalysis-...@googlegroups.com.
Visit this group at https://groups.google.com/group/mdnalysis-discussion.
For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages