Molfile Plugin for lammps

Hi everyone,
I am trying to save the snapshot of the trajectory every 100-time steps in pdb format using the dump command. But I end up with the error having ERROR on proc 0: No suitable molfile plugin found (…/dump_molfile.cpp:106)
I have the mol2plugin.so file in the working directory the input file is
variable temperature equal 150
variable randomSeed equal 15973

Initialise parameters for units and box type

units real
dimension 3
boundary p p p
atom_style full

Initital pair style and bond parameters

bond_style harmonic

dielectric 80.0

Create new simulation box or load existing box

read_restart restart.20000000

Set pair parameters

include forcefield.input

reset_atom_ids
velocity all create {temperature} {randomSeed}

special_bonds fene

neighbour list settings

neighbor 3.5 multi

Timestep and computational parameters

comm_style tiled
timestep 10

neigh_modify every 10 delay 0

fix fxnve all nve
fix fxlange all langevin {temperature} {temperature} 100000.0 ${randomSeed}
fix fxbal all balance 1000 1.1 rcb

variable binsize equal lz/200
compute dens all chunk/atom bin/1d z lower ${binsize}
fix 6 all ave/chunk 1000 1 1000 dens density/mass density/number file density.profile

fix fixCOM all recenter INIT INIT INIT # this helps to prevent drift of the interfaces and makes it easier to average over many measurements

Thermo output settings

thermo 100
thermo_style custom step pe ecoul ke temp press density
thermo_modify flush yes

dump 1 all custom 200 result.lammpstrj id mol type q xu yu zu
dump_modify 1 sort id
dump 2 all molfile 100 melt2.pdb pdb ./

Equilibration

run 500

Run simulation

#restart 10000000 restart
run 2000

write final configuration

write_data final-structure.dat nocoeff

Could anyone help me out in this regard?

The molfile plugin binary interface (ABI) changes over time (i.e. depending on the VMD version you are using), thus the files lib/molfile/molfile_plugin.h and lib/molfile/vmdplugin.h must match the version used to compile the plugin files you are using. LAMMPS contains copies of these files, but they have not been updated in a long time, since there has been no new VMD release in a long time. As people have started using VMD alpha release packages since they need better support for their hardware and want to use new features, you will need to copy the two files from your VMD installation to lib/molfile and recompile LAMMPS.

Thank you.
I tried copying both files into the lammps folder and compiled it but still facing the same error.

Just curious to know, What difference do we get if we directly load the trajectory in vmd and save the file at the required snapshot in pdb format? Will there be any change or it would still be the same?

PS: Currently, I’m trying to save the final snapshot of the cg system to convert into an all-atom model.

This question is not as easy to answer as you might think. Both, LAMMPS and VMD will write the file based on the information available internally at the time of writing. Then the output will be done by the same code through the plugin. So it all depends on how much you augment the information to get the files you need.

The biggest issue with LAMMPS versus VMD is usually that LAMMPS uses numeric types for atoms and bonds etc. while VMD uses strings. This can be corrected after the fact with some VMD scripting. In LAMMPS it is also possible to have at least a part of that information stored in a dump file, when outputting the “element” property in a custom dump and using the dump_modify element option to set this. Depending on how you created your data file, the information may also be available as comments in the data file, so you could read the data file into VMD using the TopoTools plugin and then output it as a .psf file. And then use the .psf file in combination with the LAMMPS trajectory dump to process in VMD.

Please note that the PDB file format is very problematic because of its very low precision for storing positions (not needed for x-ray data, since the resolution of x-ray is even lower). Also, creating fully standard conforming PDB files is difficult since some information is missing.

I cannot reproduce that. I just compiled LAMMPS with the headers from my VMD installation and it can use the pdbplugin.so file just fine:

$ vmd
Info) VMD for LINUXAMD64, version 1.9.4a57 (April 27, 2022)
[...]

The commands

dump 1 all molfile 1000 tip4p.pdb pdb ./
dump_modify 1 element OW HW unwrap yes

result in the log file output

Dump '1' uses molfile plugin: PDB v1.16 by Justin Gullingsrud, John Stone

and a file that looks like this:

CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1           1
ATOM      2   HW UNK X   1      -1.907   0.675  -0.143  0.00  0.00      UNK   
ATOM      3   HW UNK X   1      -1.796   1.782  -1.170  0.00  0.00      UNK   
ATOM      4   OW UNK X   2       0.386   4.607  -4.251  0.00  0.00      UNK   
ATOM      5   HW UNK X   2       0.239   3.662  -4.208  0.00  0.00      UNK   
ATOM      6   HW UNK X   2       1.268   4.730  -3.899  0.00  0.00      UNK   
ATOM      7   OW UNK X   3      -0.135   0.582  -2.994  0.00  0.00      UNK   
ATOM      8   HW UNK X   3       0.084   1.494  -2.801  0.00  0.00      UNK   
ATOM      9   HW UNK X   3       0.637   0.086  -2.720  0.00  0.00      UNK   
[...]

This suggests that you make a mistake somewhere and copied the wrong include files, used the wrong plugin binary or did not recompile LAMMPS correctly.

What platform are you on? What LAMMPS version do you use? And what VMD version?

Thank you. I corrected the error. Now it’s working and I am able to get the PDB file. But all the atoms are mentioned as UNK

ATOM      1    4 UNK X  41     -89.652 -77.310-106.296  0.00  0.00      UNK   
ATOM      2   13 UNK X  41      89.651 -75.958-109.781  0.00  0.00      UNK   
ATOM      3   20 UNK X  41     -88.827 -74.818-103.336  0.00  0.00      UNK   
ATOM      4    3 UNK X  41     -85.385 -75.569-102.018  0.00  0.00      UNK   
ATOM      5    6 UNK X   7      89.740 -81.540 -94.769  0.00  0.00      UNK   
ATOM      6   10 UNK X   7     -87.582 -80.552 -97.068  0.00  0.00      UNK   
ATOM      7    9 UNK X   7      87.593 -83.032 -97.669  0.00  0.00      UNK   
ATOM      8    1 UNK X   7     -63.256 -75.544-108.357  0.00  0.00      UNK   
ATOM      9   14 UNK X  41     -84.409 -73.775 -98.772  0.00  0.00      UNK   
ATOM     10   14 UNK X   7     -84.338 -81.849 -99.053  0.00  0.00      UNK

it’s not sorted according to the chain ids while I gave the dump_modify sort id to sort the data.

Is it possible to map the elements given as numbers to amino acids as provided in data file?

The dump_modify sort of setting sorts by atom ID which has happened. The remainder of the issue I have already discussed in my previous post.

Thank you so much for your patience and time to help me out with this error.

Another small issue, I have the masses of the amino acid file
Masses

1      71.08    # mass of CA bead (mass of A = 71.08)  # Ala  A 
2     103.00    # mass of CA bead (mass of C = 103.00) # Cys  C 
3     115.03    # mass of CA bead (mass of D = 115.03) # Asp  D 
4     129.04    # mass of CA bead (mass of E = 129.04) # Glu  E 
5     147.17    # mass of CA bead (mass of F = 147.17) # Phe  F 
6      57.05    # mass of CA bead (mass of G = 57.05)  # Gly  G 
7     137.14    # mass of CA bead (mass of H = 137.14) # His  H 
8     113.16    # mass of CA bead (mass of I = 113.16) # Ile  I 
9     128.14    # mass of CA bead (mass of K = 128.14) # Lys  K 
10    113.16    # mass of CA bead (mass of L = 113.16) # Leu  L 
11    131.20    # mass of CA bead (mass of M = 131.20) # Met  M 
12    114.10    # mass of CA bead (mass of N = 114.10) # Asn  N 
13     97.12    # mass of CA bead (mass of P = 97.12 ) # Pro  P 
14    128.13    # mass of CA bead (mass of Q = 128.13) # Gln  Q 
15    156.19    # mass of CA bead (mass of R = 156.19) # Arg  R 
16     87.08    # mass of CA bead (mass of S = 87.08 ) # Ser  S 
17    101.10    # mass of CA bead (mass of T = 101.10) # Thr  T 
18     99.13    # mass of CA bead (mass of V = 99.13 ) # Val  V 
19    186.21    # mass of CA bead (mass of W = 186.21) # Trp  W 
20    163.17    # mass of CA bead (mass of Y = 163.17) # Tyr  Y

in the data.input file and I used topo readlammpsdata data.input in VMD
but when I tried to save the file in PDB format it ended up like this

 CRYST1  180.490  180.490  800.000  90.00  90.00  90.00 P 1           1
ATOM      1  4       X  41    -272.783 103.435-102.835  0.00  0.00            
ATOM      2  13      X  41    -273.745 102.550-106.651  0.00  0.00            
ATOM      3  20      X  41    -269.022 103.610-102.832  0.00  0.00            
ATOM      4  3       X  41    -267.383 105.327-100.082  0.00  0.00

without any amino acid names could you suggest any ways to import these names into the PDB file for further processing?

PS: I am working on a system with 50 chains of protein having 140 amino acids each.

I already explained this. While the VMD TopoTools plugin can create and read such comments (if the correct metadata tag is present in the first line of the data file), the are just comments to LAMMPS and thus are ignored when processing the data file. LAMMPS cannot output information that it does not read and thus does not know about. I also already have mentioned that this issue can be avoided by creating a suitable PSF file in VMD and then it would not even be needed to output PDB files in LAMMPS, but you could just write out native LAMMPS trajectories or even more compact DCD files (which only contain the box dimensions and positions and no further information about the system).

Thank you for your help.