| 1 |
|
| 2 |
------- To view a lammps trajectory in VMD -------- |
| 3 |
|
| 4 |
|
| 5 |
1) Build a PSF file for use in viewing with VMD. |
| 6 |
|
| 7 |
This step works with VMD 1.9 and topotools 1.2. |
| 8 |
(Older versions, like VMD 1.8.6, don't support this.) |
| 9 |
|
| 10 |
|
| 11 |
a) Start VMD |
| 12 |
b) Menu Extensions->Tk Console |
| 13 |
c) Enter: |
| 14 |
|
| 15 |
(I assume that the the DATA file is called "system.data") |
| 16 |
|
| 17 |
topo readlammpsdata system.data full |
| 18 |
animate write psf system.psf |
| 19 |
|
| 20 |
2) |
| 21 |
|
| 22 |
Later, to Load a trajectory in VMD: |
| 23 |
|
| 24 |
Start VMD |
| 25 |
Select menu: File->New Molecule |
| 26 |
-Browse to select the PSF file you created above, and load it. |
| 27 |
(Don't close the window yet.) |
| 28 |
-Browse to select the trajectory file. |
| 29 |
If necessary, for "file type" select: "LAMMPS Trajectory" |
| 30 |
Load it. |
| 31 |
|
| 32 |
---- A note on trajectory format: ----- |
| 33 |
If the trajectory is a DUMP file, then make sure the it contains the |
| 34 |
information you need for pbctools (see below. I've been using this |
| 35 |
command in my LAMMPS scripts to create the trajectories: |
| 36 |
|
| 37 |
dump 1 all custom 5000 DUMP_FILE.lammpstrj id mol type x y z ix iy iz |
| 38 |
|
| 39 |
It's a good idea to use an atom_style which supports molecule-ID numbers |
| 40 |
so that you can assign a molecule-ID number to each atom. (I think this |
| 41 |
is needed to wrap atom coordinates without breaking molecules in half.) |
| 42 |
|
| 43 |
Of course, you don't have to save your trajectories in DUMP format, |
| 44 |
(other formats like DCD work fine) I just mention dump files |
| 45 |
because these are the files I'm familiar with. |
| 46 |
|
| 47 |
3) ----- Wrap the coordinates to the unit cell |
| 48 |
(without cutting the molecules in half) |
| 49 |
|
| 50 |
a) Start VMD |
| 51 |
b) Load the trajectory in VMD (see above) |
| 52 |
c) Menu Extensions->Tk Console |
| 53 |
d) Try entering these commands: |
| 54 |
|
| 55 |
pbc wrap -compound res -all |
| 56 |
pbc box |
| 57 |
|
| 58 |
----- Optional ---- |
| 59 |
To shift the box by a fraction in the x direction (for example) |
| 60 |
do this: |
| 61 |
|
| 62 |
pbc wrap -compound res -all -shiftcenterrel {-0.50 -0.52 0.0 } |
| 63 |
pbc box -shiftcenterrel {-0.50 -0.52 0.0 } |
| 64 |
|
| 65 |
# Alternately if you have a solute whose atoms are all of type 1, |
| 66 |
# then you can also try this to center the box around it: |
| 67 |
|
| 68 |
pbc wrap -sel type=1 -all -centersel type=2 -center com |
| 69 |
|
| 70 |
4) |
| 71 |
You should check if your periodic boundary conditions are too small. |
| 72 |
To do that: |
| 73 |
select Graphics->Representations menu option |
| 74 |
click on the "Periodic" tab, and |
| 75 |
click on the "+x", "-x", "+y", "-y", "+z", "-z" checkboxes. |
| 76 |
|
| 77 |
5) Optional: If you like, change the atom types in the PSF file so |
| 78 |
that VMD recognizes the atom types, use something like: |
| 79 |
|
| 80 |
sed -e 's/ 1 1 / C C /g' < system.psf > temp1.psf |
| 81 |
sed -e 's/ 2 2 / H H /g' < temp1.psf > temp2.psf |
| 82 |
sed -e 's/ 3 3 / P P /g' < temp2.psf > system.psf |
| 83 |
|
| 84 |
(If you do this, it might effect step 2 above.) |