Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grab data from db

Status
Not open for further replies.

snysmumrik

Technical User
Nov 16, 2010
3
FR
Dear all,

As an output of MOE db I get data for all conformations of molecule in a single file. Each molecule is presented like this:

<TRIPOS>MOLECULE
NONAME
28 27 1 0 0
SMALL
USER_CHARGES


@<TRIPOS>ATOM
1 C -3.2600 -0.9610 -0.1670 C.3 1 <1>
2 C -4.1980 -1.6360 0.8450 C.3 1 <1>
3 H1 -5.2480 -1.4850 0.5720 H 1 <1>
4 H2 -4.0490 -1.2270 1.8510 H 1 <1>
5 H3 -4.0270 -2.7160 0.9040 H 1 <1>
6 C -3.4170 -1.6110 -1.5490 C.3 1 <1>
7 H1 -3.2410 -2.6920 -1.5160 H 1 <1>
8 H2 -2.7040 -1.1870 -2.2660 H 1 <1>
9 H3 -4.4270 -1.4570 -1.9460 H 1 <1>
10 C -3.6360 0.5270 -0.2750 C.3 1 <1>
11 H1 -3.5390 1.0330 0.6920 H 1 <1>
12 H2 -4.6710 0.6530 -0.6150 H 1 <1>
13 H3 -2.9860 1.0500 -0.9850 H 1 <1>
14 C -1.8010 -1.0850 0.3100 C.2 1 <1>
15 O -1.0990 -0.1130 0.5820 O.2 1 <1>
16 N -1.3250 -2.3700 0.4390 N.am 1 <1>
17 H -1.9370 -3.1490 0.2390 H 1 <1>
18 C 0.0440 -2.6680 0.8420 C.3 1 <1>
19 C 0.3310 -2.3150 2.3140 C.3 1 <1>
20 H1 -0.5460 -2.5250 2.9360 H 1 <1>
21 O 0.6450 -0.9300 2.4610 O.3 1 <1>
22 H 0.0400 -0.4280 1.8700 H 1 <1>
23 C 1.5210 -3.1020 2.8440 C.3 1 <1>
24 H1 1.3360 -4.1800 2.8050 H 1 <1>
25 H2 1.7340 -2.8230 3.8820 H 1 <1>
26 H3 2.4260 -2.8800 2.2670 H 1 <1>
27 H2 0.7150 -2.1160 0.1740 H 1 <1>
28 H3 0.1770 -3.7410 0.6700 H 1 <1>

What I need for Gaussian input is to get numbers of atoms(3-rd line, 28 for this case) and get 2,3,4 columns after @<TRIPOS>ATOM - line. I realise it should be easy, but I have just started using awk, so still I am not so good in syntax. This could actually make my work easier, so I ask you to help me with finding ways to do this. Thanks.

 
Well, what is the expected output with the already provided input ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
C -3.2600 -0.9610 -0.1670
C -4.1980 -1.6360 0.8450
H1 -5.2480 -1.4850 0.5720
H2 -4.0490 -1.2270 1.8510
H3 -4.0270 -2.7160 0.9040
C -3.4170 -1.6110 -1.5490
H1 -3.2410 -2.6920 -1.5160
H2 -2.7040 -1.1870 -2.2660
H3 -4.4270 -1.4570 -1.9460
C -3.6360 0.5270 -0.2750
H1 -3.5390 1.0330 0.6920
H2 -4.6710 0.6530 -0.6150
H3 -2.9860 1.0500 -0.9850
C -1.8010 -1.0850 0.3100
O -1.0990 -0.1130 0.5820
N -1.3250 -2.3700 0.4390
H -1.9370 -3.1490 0.2390
C 0.0440 -2.6680 0.8420
C 0.3310 -2.3150 2.3140
H1 -0.5460 -2.5250 2.9360
O 0.6450 -0.9300 2.4610
H 0.0400 -0.4280 1.8700
C 1.5210 -3.1020 2.8440
H1 1.3360 -4.1800 2.8050
H2 1.7340 -2.8230 3.8820
H3 2.4260 -2.8800 2.2670
H2 0.7150 -2.1160 0.1740
H3 0.1770 -3.7410 0.6700

I have already tested code like this:

BEGIN {
print("%NProcS=2")
print("%Mem=512Mb")
printf("# bhandh/6-31G* SCF=Tight \n")
printf("\n")
printf("HPMA monomer BHandH\n")
printf("\n")
printf("0 1\n")
}

/@<TRIPOS>ATOM/ {ln=NR} ln {print $2,$3,$4,$5}

END {
printf("\n")
printf("\n")
printf("\n")
}

But there are a lot of tables like this and I am now thinking on way of splitting it one from another.
 
But there are a lot of tables like this and I am now thinking on way of splitting it one from another.
???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top