10-01-2008
program to calculate distance between 5 atoms
Hello,
I am a beginner with perl. I have a perl program to calculate the distance between 5 atoms or more.
i have an array which looks like this:
6.324 32.707 50.379
5.197 32.618 46.826
4.020 36.132 46.259
7.131 38.210 45.919
6.719 38.935 42.270
2.986 39.221 41.892
-0.269 37.184 41.565
I want to assign these values with Xi(column 1), Yi(column 2)and Zi(column 3). Suppose the first row values are (Xi,Yi,Zi), then the second row values will be (Xj, Yj, Zj) I want to calculate the distance using the formula
$dist = sqrt(($Xi-$Xj)**2+($Yi-$Yj)**2+($Zi-$Zj)**2) between row1/row2, row1/row3, row1/row4 ......so on.... till row6/row7
so its an iterative calculation. probably i shud us a for loop, and another forloop within the previous for loop. i am totally stuck.
till now my perl program looks like this:
open(IN, "/Users/anu/out.pl") or die "$!";
while (my $line = <IN>) {
chomp($line);
my @array = (split (/\s+/, $line))[6, 7, 8];
print "@array\n";
}
close(IN);
I dnt know wat to do..please help
Thank you
9 More Discussions You Might Find Interesting
1. Programming
Hi power user,
I have this type of data (distance list):
file1
A B 10
B C 20
C D 50I want output like this
# A B C D
A 0 10 30 80
B 10 0 20 70
C 30 20 0 50
D 80 70 50 0 Which is a distance matrix
I have tried... (0 Replies)
Discussion started by: anjas
0 Replies
2. UNIX for Dummies Questions & Answers
Hi folks,
Here i have written a shell script to calculate a maximum number from 10 numbers entered on command line.
max=0
echo Enter 10 numbers , one at a time
for i in 1 2 3 4 5 6 7 8 9 10
do
read n
max=`expr $max + $n`
if --- At this last step there is some problem, it gives error... (5 Replies)
Discussion started by: rits
5 Replies
3. Shell Programming and Scripting
Hi:)
I have two separate data files (.xyz) type and I want to see distances between the coordinates of atoms of the two files. For example:-
My first files contains
1 1 1 11.50910000 5.17730000 16.49360000
3 1 2 11.21790000 6.36062000 15.60660000
6 1 2 ... (4 Replies)
Discussion started by: ananyob
4 Replies
4. Shell Programming and Scripting
Hi all,
I have a data file like this
lat lon lat lon
12.000 25.125 14.235 25.012
14.200 81.000 25.584 25.014
45.023 25.365 25.152 35.222
I want to calculate distance and azimuth between this points
eg:- 12.000,25.125 and 14.235,25.012
I want to use awk programming... (3 Replies)
Discussion started by: chamara
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I'm trying to generate a distance matrix between sample pairs for use in a tree-drawing program (example below). The example below demonstrates what I'd like to get out of the data - essentially, to calculate the proportion of positions where two samples differ.
Any help much appreciated!... (1 Reply)
Discussion started by: auburn
1 Replies
6. Shell Programming and Scripting
Hello,
I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes...
I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes.
To do... (10 Replies)
Discussion started by: worm
10 Replies
7. Shell Programming and Scripting
Hi I have
the file has some formulas how to create a program (per, ksh, awk) which calculate the operation and put the result on other file
example
data of source file - this has separate by ";"... (5 Replies)
Discussion started by: Miguel Gonzalez
5 Replies
8. Shell Programming and Scripting
Hi,
I have a file as
ABC 1634230,1634284,1634349,1634468 1634272,1634301,1634356,1634534
What I want is to find distance between the numbers.. column 1 is the gene name and column 2 are starts and column 3 are their respective stops for the starts. So what I want is column 3 which has +1... (2 Replies)
Discussion started by: Diya123
2 Replies
9. Shell Programming and Scripting
Gents,
Please i will to get the distance and azimut from 2 coordinates:
Usig excel formula i get the correct values, but i will like to do it using awk.
Example
A 35089.0 50345.016 9 75 1 2101774 77 70 79 483911.6 2380106.9 137.4 1 1 6 1
A 35089.0 50345.01620 75... (8 Replies)
Discussion started by: jiam912
8 Replies
LEARN ABOUT DEBIAN
trjorder
trjorder(1) GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c trjorder(1)
NAME
trjorder - orders molecules according to their distance to a group
VERSION 4.5.4-dev-20110404-bc5695c
SYNOPSIS
trjorder -f traj.xtc -s topol.tpr -n index.ndx -o ordered.xtc -nshell nshell.xvg -[no]h -[no]version -nice int -b time -e time -dt time
-xvg enum -na int -da int -[no]com -r real -[no]z
DESCRIPTION
trjorder orders molecules according to the smallest distance to atoms in a reference group or on z-coordinate (with option -z). With
distance ordering, it will ask for a group of reference atoms and a group of molecules. For each frame of the trajectory the selected mole-
cules will be reordered according to the shortest distance between atom number -da in the molecule and all the atoms in the reference
group. The center of mass of the molecules can be used instead of a reference atom by setting -da to 0. All atoms in the trajectory are
written to the output trajectory.
trjorder can be useful for e.g. analyzing the n waters closest to a protein. In that case the reference group would be the protein and
the group of molecules would consist of all the water atoms. When an index group of the first n waters is made, the ordered trajectory can
be used with any Gromacs program to analyze the n closest waters.
If the output file is a .pdb file, the distance to the reference target will be stored in the B-factor field in order to color with e.g.
Rasmol.
With option -nshell the number of molecules within a shell of radius -r around the reference group are printed.
FILES
-f traj.xtc Input
Trajectory: xtc trr trj gro g96 pdb cpt
-s topol.tpr Input
Structure+mass(db): tpr tpb tpa gro g96 pdb
-n index.ndx Input, Opt.
Index file
-o ordered.xtc Output, Opt.
Trajectory: xtc trr trj gro g96 pdb
-nshell nshell.xvg Output, Opt.
xvgr/xmgr file
OTHER OPTIONS
-[no]hno
Print help info and quit
-[no]versionno
Print version info and quit
-nice int 19
Set the nicelevel
-b time 0
First frame (ps) to read from trajectory
-e time 0
Last frame (ps) to read from trajectory
-dt time 0
Only use frame when t MOD dt = first time (ps)
-xvg enum xmgrace
xvg plot formatting: xmgrace, xmgr or none
-na int 3
Number of atoms in a molecule
-da int 1
Atom used for the distance calculation, 0 is COM
-[no]comno
Use the distance to the center of mass of the reference group
-r real 0
Cutoff used for the distance calculation when computing the number of molecules in a shell around e.g. a protein
-[no]zno
Order molecules on z-coordinate
SEE ALSO
gromacs(7)
More information about GROMACS is available at <http://www.gromacs.org/>.
Mon 4 Apr 2011 trjorder(1)