LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] lmp.extract_compute returns Null
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] lmp.extract_compute returns Null

From: Patrick Aselin <aselip@...707...>
Date: Wed, 18 Apr 2018 00:18:44 -0400

Hello everyone!

I am working on a course project to make a very simple interface to LAMMPS through the PyLammps package working with Python3.6 and the latest LAMMPS release. My hope is to be able to run a simulation without having to save files (dump, RDF, MSD, etc). So far I have succeeded by setting up LAMMPS with

lmp = lammps()
L = PyLammps(ptr=lmp)

and then collecting thermo data from L.runs[...] and coordinates by using lmp.gather_atoms("x", 1,3). My problem is with trying to find collect the MSD and RDF computes from the provided methods. After I run the program below, I have been trying to read the RDF using variations of the command lmp.extract_compute("myRDF",0,1), but only receive types <lammps.LP_c_double at 0x7f3b88156510> that can't be subscripted as they seem to be Null. I'm not sure what I'm doing wrong here as these commands seem to follow the manuals. Is what I am trying to do even possible? Would it be better to just collect the coordinate data and then use another Python function to compute these?



from lammps import lammps, PyLammps
lmp = lammps()
L = PyLammps(ptr=lmp)

L.atom_style(" atomic")
L.atom_modify("map array")
L.lattice("fcc 0.8442")
L.region("box block 0 4 0 4 0 4")
L.create_box("1 box")
L.create_atoms("1 box")
L.mass("1 1.0")
L.velocity("all create 1.44 87287 loop geom")
L.pair_style("lj/cut 2.5")
L.pair_coeff("1 1 1.0 1.0 2.5")
L.neighbor("0.3 bin")
L.neigh_modify("delay 0 every 20 check no")
L.fix("1 all nve")

L.compute("msdcal all msd") #Compute msd
L.compute("myRDF all rdf 50") # Compute rdf

L.fix("4 all ave/time 100 1 100 c_myRDF[*] file mode vector")
L.fix("5 all ave/time 1 1 1 c_msdcal[4] file mode scalar")

L.thermo_style("custom step temp ke pe etotal vol press pxx pyy pzz lx ly lz enthalpy")
L.dump("id all atom 50 dump.melt")

lmp.extract_compute("myRDF",0,1) #returns null