By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,955 Members | 1,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,955 IT Pros & Developers. It's quick & easy.

Regarding converting file from one format to another

P: 4
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
File Type: txt sample.txt (6.0 KB, 168 views)
File Type: txt code1.txt (245 Bytes, 163 views)
Jan 31 '18 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 613
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.
Jan 31 '18 #2

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

Post your reply

Sign in to post your reply or Sign up for a free account.