From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Sat Apr 12 2014 - 09:37:43 CDT

Hi Ashish,
You should try to include the list in your replies. I don't use LAMMPS,
so I have no idea what its output structure is (for instance, I have no
idea how topology is stored).

Your output looks like a simple xyz formatted file. This is enough to
make a PDB, since neither file format stores connectivity information.
Step 1 is to load the output into VMD (mol new file.xyz). When reading
in xyz files, VMD assumes that the first column is the atom name (and in
this case will do the conversion from 1->H and 2->He). From there you
can make atomselections to rename things and write a pdb.

set Cusel [atomselect top "name H"]
$Cusel set name Cu
set Zrsel [atomselect top "name He"]
$Zrsel set name Zr
set all [atomselect top "all"]
$all writepdb output.pdb

Quick question, are there really spaces between minus signs and the
z-coordinate in your files? If so, that's something you'll need to
correct. :)
Good luck!
-Josh Vermaas

On 04/12/2014 09:12 AM, Ashish .Chauniyal wrote:
> Hi Josh,
> Thanks for helping out before. However I am still a little stuck with
> things that are too trivial for experts like you. Here is my complete
> problem, I have a box consisting of several thousand atoms namely Cu
> and Zr. These atoms are simulated using LAMMPS under specific
> conditions. This information about the atoms and their coordinates is
> saved in a data file, which I was hoping to read in VMD. I have to
> merge this structure with another similar structure at some interface.
> There fore I need to do operations such as displacing the entire atoms
> by some value and then combining things.
>
> So with this in mind ,I was using topotools but really got confused
> since all the documentation emphasis is on molecular structures and
> all that. I feel my case is simple , read some file, move it around
> and then merge it for future use in lammps.
> The last bit of code I sent you was modified from Alex Kohlemeyrs
> tutorials, but it does not really work in may case. I have a lammps
> data file in the following format.
> 6400
> Atoms. Timestep: 300
> 2 -41.9649 84.4817 4.01756
> 2 -40.6413 -83.3137 -3.67139
> 1 -42.2923 -84.0662 -1.43588
> 1 42.1149 -82.3104 -1.12892
> 2 -39.1661 84.087 - 3.9539
> 1 -36.989 -83.8449 -4.08889
> 1 -34.7283 85.2272 - 0.185181
> 2 -38.7322 -84.3027 - 1.5362
> 1 -33.5458 84.8172 -4.30221
> 2 -31.8768 -83.9025 4.09117
>
> where 1 and 2 denote atom type Cu and Zr respectively and the other 3
> colums represent x y & z. How do you think I can play with this in
> VMD. Also the documentation on this is very hard to find.
> Thanks again.
>
> regards,
> Ashish
>
>
> On Fri, Apr 11, 2014 at 8:59 PM, Josh Vermaas <vermaas2_at_illinois.edu
> <mailto:vermaas2_at_illinois.edu>> wrote:
>
> Hi Ashish,
>
> If you are just trying to make a pdb-formatted file out of this,
> literally all you need to do is:
>
> set all [atomselect top "all"]
> $all writepdb filename.pdb
>
> I'm not familiar with the file format you are using. What do the
> first two columns and last three columns mean? What does VMD think
> the fields mean (ie, if you go to the graphical representations
> window, what are the values associated with each keyword)? You
> haven't given me (or anyone else) enough information to help you
> effectively. My advice would be to play around with the graphical
> representations, and try to play around with the atomselections to
> separate the two types of atoms. The easiest way to do this would
> probably be to look at the keyword-value pairs (under the
> "selections" tab of the graphical representations window), and
> determine which keywords/values pick between Copper and not copper
> atoms.
>
> Good luck!
> -Josh Vermaas
>
>
> On 04/11/2014 10:17 AM, Ashish .Chauniyal wrote:
>> Dear Josh,
>> I was having some problem with the usage of the 'atomselect'
>> command and wonder if you could suggest something as you in your
>> previous post. I am a little confused with the explaination given
>> in the user guide regarding atomselect.
>>
>> I have a file containing 2 types of atoms and their coordinates.
>> given below <Atomid> <type><x><y><z>.
>>
>> Atoms
>>
>> 4003 2 -3.6948671457303270e+01 -8.2178357941409985e+01
>> -1.0333348401063144e+01 0 0 1
>> 807 1 -3.6990060733492541e+01 -8.0262837680770645e+01
>> -8.2698926717344481e+00 0 0 0
>> 1 1 -4.1360378365219930e+01 -8.0595341475920435e+01
>> -1.1523945200048335e+01 0 0 0
>> 85 2 -3.8964145243144991e+01 -7.9837065660776460e+01
>> -1.0375438044916475e+01 0 0 0
>> ........
>>
>>
>> I just need to read the file an make a .pdb format out of it.
>>
>> ## this is part of the code, where i try to read only type 1
>> atoms, is this correct?
>> set selc [atomselect top "resid 1"]
>> $selc set type Cu
>> $selc set resname PPP
>>
>> set resid {}
>> foreach r [$selc get residue] {
>> incr r
>> lappend resid $r
>> }
>> $selc set resid $resid
>> $selc delete
>>
>>
>> Thanks in advance,
>>
>> regards,
>> Ashish Chauniyal
>> Deptt. Mechanical Engg.
>> BITS Pilani(INDIA)
>>
>>
>> On Fri, Apr 11, 2014 at 7:58 PM, Josh Vermaas
>> <vermaas2_at_illinois.edu <mailto:vermaas2_at_illinois.edu>> wrote:
>>
>> Hi Vlad,
>>
>> It is certainly doable, but requires some bookkeeping on your
>> end. If you look at the user guide, the measure fit command
>> takes an optional argument:
>> *fit /selection1/ /selection2/ [weight /weight/] [order
>> /index list/]*
>> Again taken from the user guide:
>> The optional flag /order/ takes as argument a list of 0-based
>> indices specifying how to reorder the atoms in /selection2/
>> (Example: To reverse the order of atoms in a selection
>> containing 10 atoms one would use order {9 8 7 6 5 4 3 2 1 0}).
>>
>> I've never needed to use this feature so far, but what I
>> believe you'd need to do is make an index list that puts them
>> into the order you want. This is an outline to get you started:
>>
>> set indexlist [list ]
>>
>> foreach resid [list 8 9 10] {
>> set sel [atomselect 2 "resid $resid"]
>> #To figure out how big the offset needs to be, we need to
>> know how many atoms in the selection are out of order before us.
>> set abovesel [atomselect 2 "resid 8 9 10 and resid > $resid"]
>> set counter 0
>> foreach el [$sel get index] {
>> lappend indexlist [expr { [$abovesel num] + $counter] } ]
>> incr counter
>> }
>> $abovesel delete
>> $sel delete
>> }
>>
>> The reason you have to do these gymnastics is because VMD
>> stores atoms in the order they were loaded, and decides if an
>> atom is inside or outside of an atomselection following this
>> order. This is why if you ever tried an atomselection like
>> "resid 11 1", it will return indices that are in increasing
>> order, rather than returning the indices belonging to residue
>> 11 then those belonging to residue 1.
>>
>> -Josh Vermaas
>>
>>
>>
>>
>> On 04/11/2014 07:16 AM, Vlad Cojocaru wrote:
>>> Dear all,
>>>
>>> I have a rather simple question but for which I did no
>>> figure an answer yet ... I have 2 DNA molecules which I want
>>> to superimpose.
>>> The superposition should be done like this:
>>>
>>> res 1 from mol 1 on res 10 from mol 2,
>>> res 2 from mol 1 on res 9 from mol 2,
>>> res 3 from mol 1 on res 8 from mol2,
>>>
>>> .. and so on ...
>>>
>>> If I do the selections "resid 1 to 3" and "resid 10 to 8",
>>> it does not work as VMD tries to superimpose 1 on 8, 2 on 9,
>>> and 3 on 10.
>>> I also tried to change the residue numbers in mol 2 such as
>>> res 10 becomes res 100, res 9 becomes res 101, res 8 becomes
>>> res 102 (to have ascending order). However, still no
>>> success, VMD does not care about the residue number, it
>>> still tries the same. ...
>>>
>>> Do I need to change all atom indices to actually make VMD
>>> superimpose the way I want ? Or is there an easier solution
>>> to this ?
>>>
>>> Thanks for any advice ..
>>>
>>> Best wishes
>>> Vlad
>>>
>>>
>>
>>
>
>