[gmx-users] topologies with explicit parameters
K.A.Feenstra
k.a.feenstra at chem.rug.nl
Tue Dec 18 13:06:28 CET 2001
Hi All,
I just wrote a small awk script wich takes a preprocessed topology (i.e.
produced using 'grompp -pp', or manually preprocessed with cpp) or one
which has all types defined explicitly and parses in the explicit atom
names and parameters for all interactions defined. It is not fool-proof,
but imho it can be a very useful tool when debugging your new topology.
(Of course, at some time this should/will be implemented into the gromacs
topology parsing tools.)
I've attached the 2k script, try it out...
--
Groetjes,
Anton
_____________ _____________________________________________________
| | Anton Feenstra Dept. of Biophysical Chemistry |
| _ _ ___,| K.A.Feenstra at chem.rug.nl University of Groningen |
| / \ / \'| | | Tel +31 50 363 4327 Nijenborgh 4 |
|( | )| | | Fax +31 50 363 4800 9747 AG Groningen |
| \_/ \_/ | | | http://md.chem.rug.nl/~anton The Netherlands |
| | "Nurture Another Mind, Before Yours Expires" (Arrest|
|_____________|_____________________________________________________|
-------------- next part --------------
#!/usr/bin/awk -f
$1==";" || $1=="#" || !NF { next; }
$1=="[" { read = 0; }
$2=="pairtypes" { read="pairs"; na=2; }
$2=="bondtypes" { read="bonds"; na=2; }
$2=="angletypes" { read="angles"; na=3; }
$2=="dihedraltypes" { read="dihedrals"; na=2; }
$2=="atoms" || $2=="bonds" || $2=="pairs" || $2=="angles" || $2=="dihedrals" {
print; read=0; write=$2; na=2;
}
$2=="angles" { na=3; }
$2=="dihedrals" { na=4; }
$1=="[" && write && write!="atoms" {
if (na==2)
printf(";%4s %5s", "ai", "aj");
else if (na==3)
printf(";%4s %5s %5s", "ai", "aj", "ak");
else if (na==4)
printf(";%4s %5s %5s %5s", "ai", "aj", "ak", "al");
printf(" %3s %s\n", "tp", "parameters");
}
$1=="[" && write=="atoms" {
printf ("; nr type resnr residu name cgnr charge mass\n");
}
$1=="[" { next; }
read {
a = (na==2) ? $1 " " $2 : $1 " " $2 " " $3;
tp = $(na+1)
p = "";
for(i=na+2; i<=NF; i++)
p = p sprintf(" %8g", $i);
itype[read,a,tp]=p;
}
write=="atoms" {
atype[$1]=$2;
aname[$1]=$5;
gsub("[ \t]*;.*","");
print;
next;
}
write {
if ( NF==na+1 ) {
tp = $(na+1);
a = (na==2) ? atype[$1] " " atype[$2] \
: (na==3) ? atype[$1] " " atype[$2] " " atype[$3] \
: (tp==1) ? atype[$2] " " atype[$3] \
: atype[$1] " " atype[$4] ;
z = (na==2) ? atype[$2] " " atype[$1] \
: (na==3) ? atype[$3] " " atype[$2] " " atype[$1] \
: (tp==1) ? atype[$3] " " atype[$2] \
: atype[$4] " " atype[$1] ;
p = itype[write, a, tp];
if (!p)
p = itype[write, z, tp];
} else {
p = "";
for(i=na+2; i<=NF; i++)
p = p sprintf(" %8g", $i);
}
if (na==2)
printf ("%5s %5s", aname[$1], aname[$2]);
else if (na==3)
printf ("%5s %5s %5s", aname[$1], aname[$2], aname[$3]);
else
printf ("%5s %5s %5s %5s", aname[$1], aname[$2], aname[$3], aname[$3]);
printf (" %3d %s\n", tp, p);
}
# last line
More information about the gromacs.org_gmx-users
mailing list