I'm generating 3D coordinates (x,y,z) to a file with the following code.
for (my $x = 0.000; $x < 4.200; $x += 1.400) {
for (my $y = 0.000; $y < 4.200; $y += 1.400) {
for (my $z = 0.000; $z < 4.200; $z += 1.400) {
push @arr_grid, "$x $y $z\n";
}
}
}
foreach (@arr_grid) {
say "HETATM 1 O HOH 1 $_ O";
}
Now, my problem is that I want to get the output with a precise format (PDB) with Index values like,
1-6 7-11 13-16 18-20 23-26 31-38 39-46 47-54 77-78
(Name) (S.No) (x) (y) (z)
HETATM 1 O HOH 1 -8.863 16.944 14.289 N
HETATM 100 O HOH 16 -15.352 11.525 5.325 N
HETATM 117 O HOH 16 -12.954 9.717 5.182 C
HETATM 126 O HOH 17 -19.225 11.667 -0.391 C
HETATM 1005 O HOH 97 9.246 23.287 11.503 O
Here the x,y,z coordinates shoulb be of data type real(8.2) and others are right justified. x,y,z values are not those generated from program. I placed arbitrary values. Please help me.
Presumably, you could replace the existing:
with some suitable variation of:
This gives you control over the format of the numbers.