473,225 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 software developers and data experts.

Recursive insertion of a line

New to the list and just beginning with Python (Linux B console). Urgent
problem before I can correctly program:

How to insert "TER" records recursively, i.e. some thousand fold, in a file
like in the following example? "H2 WAT" is the only constant characteristic of
the line after which to insert "TER"; that distinguishes also for lines for
other atoms. Just to illustrate what I want to do - for those unfamiliar with
this type of file - a three-line set between two "TER" defines a water
molecule, with a set of xyz coordinates for each atom.

TER
ATOM 27394 O WAT 3966 17.713 13.305 27.101 1.00 0.00 W20 O
ATOM 27395 H1 WAT 3966 17.814 13.945 26.397 1.00 0.00 W20 H
ATOM 27396 H2 WAT 3966 16.776 13.297 27.297 1.00 0.00 W20 H
TER
ATOM 27397 O WAT 4144 0.648 8.291 27.112 1.00 0.00 W20 O
ATOM 27398 H1 WAT 4144 0.344 8.314 26.205 1.00 0.00 W20 H
ATOM 27399 H2 WAT 4144 1.278 7.571 27.144 1.00 0.00 W20 H
TER
ATOM 27400 O WAT 4178 20.289 4.598 26.491 1.00 0.00 W20 O
ATOM 27401 H1 WAT 4178 19.714 3.835 26.423 1.00 0.00 W20 H
ATOM 27402 H2 WAT 4178 21.173 4.237 26.554 1.00 0.00 W20 H
TER

Thanks
francesco pietra

__________________________________________________ __________________________________
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs
Nov 19 '07 #1
0 720

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Xavier Decoret | last post by:
I am reading the lines of a file, executing appropriate command if a pattern is found. One of the pattern can be a input command whose effect should be to #include the file (possibly recursively) ...
5
by: Magnus Lyck? | last post by:
Something really strange is happening to me (sometimes). I'm using Python 2.3.2 on NT 4.0 as well as win32all-157, adodbapi and db_row. During a recursive call to a method, it seems Python...
6
by: jack | last post by:
I have a class which overloads the insertion operator '<<' for every type that ostream handles. I do this so that I can use my class a direct replacement for cout and cerr where the insertion...
3
by: Ameen | last post by:
I am very new to programming and VB.net, and I wrote the code below, but it seem to go on an infinite loop. Please tell me what I am doing wrong. Private Sub search(ByVal indexstart) Pos1 =...
5
by: phiefer3 | last post by:
I'm currently a student, but this problem isn't directly related to what I have to do on an assignment. It's just a problem I've had with some supporting features. First of all, I'm using MSVS...
3
by: mizrandir | last post by:
Can someone tell me why python doesn't crash when I do the following: ] ] How does python handle this internally? Will it crash or use up lot's of memory in similar but more complicated cases?
9
by: python_newbie | last post by:
I don't know this list is the right place for newbie questions. I try to implement insertion sort in pyhton. At first code there is no problem. But the second one ( i code it in the same pattern i...
1
by: nembo kid | last post by:
I need of your advice. A good link where I can learn linked lists with recursive method (reverse, merge, sort, insertion and so on); well commented and explained.
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.