Regarding converting file from one format to another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DilipHN
    New Member
    • Jan 2018
    • 4

    Regarding converting file from one format to another

    Hello,
    I am a newbie to coding and now learning python programming.

    I have a file named nptmdtrj.txt file which has water, glycine molecules along with x,y,z coordinates. I want only the oxygen of water (named as OW)along with its x,y,z coordinates to be written in another file. I am able to do it, but the problem is i am not able to write the frames ie., as in 1st column in sample.dat file...

    I am herein attaching the files..
    1) nprmdtrj1.txt is the original file
    2) sample.txt is the output file i want to get
    3) code1.py is the python code i tried..
    4) Trial2.txt is the file i got as output after i ran code1.py.

    Any suggestions are highly appreciated...

    I am unable to upload the rest of the files.. any suggestions..??
    Attached Files
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    i am not able to write the frames ie., as in 1st column in sample.dat file
    You write the entire line, so if it is not written then it is not in that line. Also, there is no "OW" anywhere in the sample.txt file that you posted so you will get an empty output file.

    Comment

    • DilipHN
      New Member
      • Jan 2018
      • 4

      #3
      Actually, the OW's are in the nptmdtrj1.txt file and this file i am unable to load/attach since it is giving error...

      Comment

      Working...