remove trailing whitespace

This commit is contained in:
Axel Kohlmeyer
2016-10-03 07:07:28 -04:00
parent 45d2cc2895
commit 6e719f2d94
3 changed files with 227 additions and 227 deletions

View File

@ -41,9 +41,9 @@ should be -option=value (e.g. -border=5).
-border add border to all sides of simulation box [default: 0 A] -border add border to all sides of simulation box [default: 0 A]
-ax rotation around x-axis -ax rotation around x-axis
-ay rotation around y-axis -ay rotation around y-axis
-az rotation around z-axis -az rotation around z-axis
-cd correction for dihedral for carbohydrate systems -cd correction for dihedral for carbohydrate systems
-cmap add CMAP section to data file and fix cmap command lines in -cmap add CMAP section to data file and fix cmap command lines in
input script" (NOTE: requires use of *.pdb file) input script" (NOTE: requires use of *.pdb file)
In the "example" folder, you will find example files that were created In the "example" folder, you will find example files that were created
@ -69,26 +69,26 @@ file has to the corresponding names in the charmm FF files. You'll
need to add a "pdbalias residue x xnew" line for each change that need to add a "pdbalias residue x xnew" line for each change that
needs to be made. The *.pgn should contain something like this: needs to be made. The *.pgn should contain something like this:
package require psfgen package require psfgen
topology top_all27_na.rtf topology top_all27_na.rtf
pdbalias residue A ADE pdbalias residue A ADE
pdbalias residue T THY pdbalias residue T THY
pdbalias residue G GUA pdbalias residue G GUA
pdbalias residue C CYT pdbalias residue C CYT
. .
. .
. .
segment A {pdb 1ac7_pared.pdb} segment A {pdb 1ac7_pared.pdb}
coordpdb 1ac7_pared.pdb A coordpdb 1ac7_pared.pdb A
guesscoord guesscoord
writepdb 1ac7.pdb writepdb 1ac7.pdb
writepsf charmm 1ac7.psf writepsf charmm 1ac7.psf
exit exit
5) Type "vmd -e 1ac7.pgn" to build the 1ac7.psf file, and the new 5) Type "vmd -e 1ac7.pgn" to build the 1ac7.psf file, and the new
1ac7.pdb file. 1ac7.pdb file.
6) Run charmm2lammps.pl by typing: 6) Run charmm2lammps.pl by typing:
"perl charmm2lammps.pl all27_na 1ac7 -charmm -border=1 -pdb_ctrl -water -ions" "perl charmm2lammps.pl all27_na 1ac7 -charmm -border=1 -pdb_ctrl -water -ions"
7) Run lammps by typing: "lmp < 1ac7.in" 7) Run lammps by typing: "lmp < 1ac7.in"
@ -105,7 +105,7 @@ molecule. The -pdb_ctrl option produces the 1ac7_ctrl.pdb file that
can be visualized in a standard visualization package such as VMD. The can be visualized in a standard visualization package such as VMD. The
-charmm option put comments into the LAMMPS data file (everything -charmm option put comments into the LAMMPS data file (everything
after the # sign is a comment) for user convenience in tracking atom after the # sign is a comment) for user convenience in tracking atom
types etc. according to CHARMM nomenclature. types etc. according to CHARMM nomenclature.
The example molecule provided above (i.e., 1ac7) is a DNA fragment. The example molecule provided above (i.e., 1ac7) is a DNA fragment.
If instead, a peptide longer than 2 amino acid residues or a protein If instead, a peptide longer than 2 amino acid residues or a protein

View File

@ -10,7 +10,7 @@
# 20050212 Needed (in the same directory): # 20050212 Needed (in the same directory):
# - $project.crd ; Assumed to be correct and running # - $project.crd ; Assumed to be correct and running
# - $project.psf ; CHARMM configs # - $project.psf ; CHARMM configs
# - top_$forcefield.rtf ; # - top_$forcefield.rtf ;
# - par_$forcefield.prm ; # - par_$forcefield.prm ;
# Ouput: # Ouput:
# - $project.data ; LAMMPS data file # - $project.data ; LAMMPS data file
@ -41,10 +41,10 @@
# #
# General Many thanks to Paul S. Crozier for checking script validity # General Many thanks to Paul S. Crozier for checking script validity
# against his projects. # against his projects.
# Also thanks to Xiaohu Hu (hux2@ornl.gov) and Robert A. Latour # Also thanks to Xiaohu Hu (hux2@ornl.gov) and Robert A. Latour
# (latourr@clemson.edu), David Hyde-Volpe, and Tigran Abramyan, # (latourr@clemson.edu), David Hyde-Volpe, and Tigran Abramyan,
# Clemson University and Chris Lorenz (chris.lorenz@kcl.ac.uk), # Clemson University and Chris Lorenz (chris.lorenz@kcl.ac.uk),
# King's College London for their efforts to add CMAP sections, # King's College London for their efforts to add CMAP sections,
# which is implemented using the option flag "-cmap". # which is implemented using the option flag "-cmap".
# Initialization # Initialization
@ -52,7 +52,7 @@
sub Test sub Test
{ {
my $name = shift(@_); my $name = shift(@_);
printf("Error: file %s not found\n", $name) if (!scalar(stat($name))); printf("Error: file %s not found\n", $name) if (!scalar(stat($name)));
return !scalar(stat($name)); return !scalar(stat($name));
} }
@ -63,7 +63,7 @@
my $k = 0; my $k = 0;
my @dir = ("x", "y", "z"); my @dir = ("x", "y", "z");
my @options = ("-help", "-nohints", "-water", "-ions", "-center", my @options = ("-help", "-nohints", "-water", "-ions", "-center",
"-quiet", "-pdb_ctrl", "-l", "-lx", "-ly", "-lz", "-quiet", "-pdb_ctrl", "-l", "-lx", "-ly", "-lz",
"-border", "-ax", "-ay", "-az", "-cmap"); "-border", "-ax", "-ay", "-az", "-cmap");
my @remarks = ("display this message", my @remarks = ("display this message",
"do not print type and style hints in data file", "do not print type and style hints in data file",
@ -83,7 +83,7 @@
"generate a CMAP section in data file" "generate a CMAP section in data file"
); );
my $notes; my $notes;
$program = "charmm2lammps"; $program = "charmm2lammps";
$version = "1.9.0"; $version = "1.9.0";
$year = "2016"; $year = "2016";
@ -99,7 +99,7 @@
$L = (0, 0, 0); $L = (0, 0, 0);
$cmap = 0; $cmap = 0;
@R = M_Unit(); @R = M_Unit();
$notes = " * The average of extremes is used as the origin\n"; $notes = " * The average of extremes is used as the origin\n";
$notes .= " * Residues are numbered sequentially\n"; $notes .= " * Residues are numbered sequentially\n";
$notes .= " * Water is added on an FCC lattice: allow 5 ps for"; $notes .= " * Water is added on an FCC lattice: allow 5 ps for";
@ -119,7 +119,7 @@
$notes .= " - project.data LAMMPS data file\n"; $notes .= " - project.data LAMMPS data file\n";
$notes .= " - project.in suggested LAMMPS input script\n"; $notes .= " - project.in suggested LAMMPS input script\n";
$notes .= " - project_ctrl.pdb control file when requested\n"; $notes .= " - project_ctrl.pdb control file when requested\n";
foreach (@ARGV) foreach (@ARGV)
{ {
if (substr($_, 0, 1) eq "-") if (substr($_, 0, 1) eq "-")
@ -200,7 +200,7 @@
return "{".$v[0].", ".$v[1].", ".$v[2]."}"; return "{".$v[0].", ".$v[1].", ".$v[2]."}";
} }
sub V_Add sub V_Add
{ {
my @v1 = splice(@_, 0, 3); my @v1 = splice(@_, 0, 3);
@ -208,8 +208,8 @@
return ($v1[0]+$v2[0], $v1[1]+$v2[1], $v1[2]+$v2[2]); return ($v1[0]+$v2[0], $v1[1]+$v2[1], $v1[2]+$v2[2]);
} }
sub V_Subtr sub V_Subtr
{ {
my @v1 = splice(@_, 0, 3); my @v1 = splice(@_, 0, 3);
@ -217,8 +217,8 @@
return ($v1[0]-$v2[0], $v1[1]-$v2[1], $v1[2]-$v2[2]); return ($v1[0]-$v2[0], $v1[1]-$v2[1], $v1[2]-$v2[2]);
} }
sub V_Dot sub V_Dot
{ {
my @v1 = splice(@_, 0, 3); my @v1 = splice(@_, 0, 3);
@ -226,8 +226,8 @@
return $v1[0]*$v2[0]+$v1[1]*$v2[1]+$v1[2]*$v2[2]; return $v1[0]*$v2[0]+$v1[1]*$v2[1]+$v1[2]*$v2[2];
} }
sub V_Mult sub V_Mult
{ {
my @v = splice(@_, 0, 3); my @v = splice(@_, 0, 3);
@ -236,12 +236,12 @@
return ($f*$v[0], $f*$v[1], $f*$v[2]); return ($f*$v[0], $f*$v[1], $f*$v[2]);
} }
sub M_String sub M_String
{ {
my $string; my $string;
for (my $i=0; $i<3; ++$i) for (my $i=0; $i<3; ++$i)
{ {
$string .= ", " if ($i); $string .= ", " if ($i);
$string .= V_String(splice(@_, 0, 3)); $string .= V_String(splice(@_, 0, 3));
@ -258,7 +258,7 @@
@_[2], @_[5], @_[8]); @_[2], @_[5], @_[8]);
} }
sub M_Dot sub M_Dot
{ {
my @v11 = splice(@_, 0, 3); my @v11 = splice(@_, 0, 3);
@ -268,7 +268,7 @@
my @v21 = splice(@m, 0, 3); my @v21 = splice(@m, 0, 3);
my @v22 = splice(@m, 0, 3); my @v22 = splice(@m, 0, 3);
my @v23 = splice(@m, 0, 3); my @v23 = splice(@m, 0, 3);
return ( return (
V_Dot(@v11, @v21), V_Dot(@v11, @v22), V_Dot(@v11, @v23), V_Dot(@v11, @v21), V_Dot(@v11, @v22), V_Dot(@v11, @v23),
V_Dot(@v12, @v21), V_Dot(@v12, @v22), V_Dot(@v12, @v23), V_Dot(@v12, @v21), V_Dot(@v12, @v22), V_Dot(@v12, @v23),
@ -279,7 +279,7 @@
sub M_Unit { return (1,0,0, 0,1,0, 0,0,1); } sub M_Unit { return (1,0,0, 0,1,0, 0,0,1); }
sub PI { return 4*atan2(1,1); } sub PI { return 4*atan2(1,1); }
sub M_Rotate sub M_Rotate
{ # vmd convention { # vmd convention
my $n = shift(@_); my $n = shift(@_);
@ -294,7 +294,7 @@
return ($cos,-$sin,0, $sin,$cos,0, 0,0,1) if ($n==2); # around z-axis return ($cos,-$sin,0, $sin,$cos,0, 0,0,1) if ($n==2); # around z-axis
return M_Unit(); return M_Unit();
} }
sub MV_Dot sub MV_Dot
{ {
@ -305,10 +305,10 @@
return (V_Dot(@v11, @v2), V_Dot(@v12, @v2), V_Dot(@v13, @v2)); return (V_Dot(@v11, @v2), V_Dot(@v12, @v2), V_Dot(@v13, @v2));
} }
# CHARMM input # CHARMM input
sub PSFConnectivity sub PSFConnectivity
{ {
my $n = PSFGoto(bonds); my $n = PSFGoto(bonds);
@ -353,8 +353,8 @@
$dihedral_flag = 1; $dihedral_flag = 1;
return $ndihedral; return $ndihedral;
} }
sub CreatePSFIndex # make an index of id sub CreatePSFIndex # make an index of id
{ # locations { # locations
my @psf_ids = ("!NATOM","!NBOND:","!NTHETA:","!NPHI:","!NIMPHI:"); my @psf_ids = ("!NATOM","!NBOND:","!NTHETA:","!NPHI:","!NIMPHI:");
@ -374,13 +374,13 @@
} }
} }
sub PSFGoto # goto $ident in <PSF> sub PSFGoto # goto $ident in <PSF>
{ {
CreatePSFIndex() if (!scalar(%PSFIndex)); CreatePSFIndex() if (!scalar(%PSFIndex));
my $id = shift(@_); my $id = shift(@_);
my @n = split(" ", $PSFIndex{$id}); my @n = split(" ", $PSFIndex{$id});
@PSFBuffer = (); @PSFBuffer = ();
# return PSFDihedrals() if ($id eq "dihedrals"); # return PSFDihedrals() if ($id eq "dihedrals");
if (!scalar(@n)) if (!scalar(@n))
@ -415,10 +415,10 @@
{ {
my $items = shift(@_); my $items = shift(@_);
my $n = $items; my $n = $items;
if ($psf_ncols>7) { printf(PSF_CTRL "\n"); $psf_ncols = 0; } if ($psf_ncols>7) { printf(PSF_CTRL "\n"); $psf_ncols = 0; }
foreach(@_) foreach(@_)
{ {
printf(PSF_CTRL " %7d", $_); printf(PSF_CTRL " %7d", $_);
++$psf_ncols; ++$psf_ncols;
if ((!--$n) && ($psf_ncols>7)) if ((!--$n) && ($psf_ncols>7))
@ -434,7 +434,7 @@
sub CRDGoto sub CRDGoto
{ {
my $n; my $n;
return if (shift(@_) ne "atoms"); return if (shift(@_) ne "atoms");
open(CRD, "<".($pdb ? $Pdb : $Crd)) if (fileno(CRD) eq ""); open(CRD, "<".($pdb ? $Pdb : $Crd)) if (fileno(CRD) eq "");
seek(CRD, 0, SEEK_SET); seek(CRD, 0, SEEK_SET);
@ -451,20 +451,20 @@
my @data = (); my @data = ();
my $c = 0; my $c = 0;
my $line; my $line;
while (substr($line = <CRD>, 0, 4) ne "ATOM") {}; while (substr($line = <CRD>, 0, 4) ne "ATOM") {};
chop($line); chop($line);
foreach (@n) { push(@data, substr($line, ($c += $_)-$_, $_)); } foreach (@n) { push(@data, substr($line, ($c += $_)-$_, $_)); }
return @data[1, 8, 5, 3, 11, 12, 13, 17, 8, 15]; return @data[1, 8, 5, 3, 11, 12, 13, 17, 8, 15];
} }
sub Delete sub Delete
{ {
my $item = shift(@_); my $item = shift(@_);
my $k = 0; my $k = 0;
my @list; my @list;
foreach (@_) foreach (@_)
{ {
my @tmp = split(" "); my @tmp = split(" ");
@ -483,9 +483,9 @@
my $flag = $list[0] gt $list[-1]; my $flag = $list[0] gt $list[-1];
my $j = $n; my $j = $n;
my $tmp; my $tmp;
return "" if (scalar(@list)<$n); return "" if (scalar(@list)<$n);
$flag = $list[1] gt $list[-2] $flag = $list[1] gt $list[-2]
if ((scalar(@list)>3)&&($list[0] eq $list[-1])); if ((scalar(@list)>3)&&($list[0] eq $list[-1]));
for (my $i=0; $i<$n; ++$i) for (my $i=0; $i<$n; ++$i)
{ {
@ -506,7 +506,7 @@
for (my $i=0; $i<$n; ++$i) for (my $i=0; $i<$n; ++$i)
{ {
my @tmp = split(" ", <PSF>); my @tmp = split(" ", <PSF>);
$tmp[5] = $symbols{$tmp[5]} $tmp[5] = $symbols{$tmp[5]}
if ((substr($tmp[5],0,1) lt '0')||(substr($tmp[5],0,1) gt '9')); if ((substr($tmp[5],0,1) lt '0')||(substr($tmp[5],0,1) gt '9'));
push(@atom_types, $tmp[5]); push(@atom_types, $tmp[5]);
++$list{$tmp[5]}; ++$list{$tmp[5]};
@ -524,7 +524,7 @@
return sort({$a<=>$b} keys(%list)); return sort({$a<=>$b} keys(%list));
} }
sub Markers sub Markers
{ {
my %markers = ( my %markers = (
@ -543,14 +543,14 @@
{ {
my @cols = @_; my @cols = @_;
my $f = (scalar(@cols)>3)&&(substr($cols[3],0,1) ne "!"); my $f = (scalar(@cols)>3)&&(substr($cols[3],0,1) ne "!");
my @tmp = (-$cols[1], $cols[2], my @tmp = (-$cols[1], $cols[2],
$f ? -$cols[4]:-$cols[1], $f ? $cols[5]:$cols[2]); $f ? -$cols[4]:-$cols[1], $f ? $cols[5]:$cols[2]);
$tmp[1] *= 2.0**(5/6); # adjust sigma $tmp[1] *= 2.0**(5/6); # adjust sigma
$tmp[3] *= 2.0**(5/6); # adjust sigma 1-4 $tmp[3] *= 2.0**(5/6); # adjust sigma 1-4
return join(" ", @tmp); return join(" ", @tmp);
} }
sub AtomParameters # non-bonded parameters sub AtomParameters # non-bonded parameters
{ {
my @types; my @types;
@ -574,7 +574,7 @@
if ($markers{$cols[0]} ne "") { if ($markers{$cols[0]} ne "") {
$read = ($markers{$cols[0]} eq "0") ? 1 : 0; } $read = ($markers{$cols[0]} eq "0") ? 1 : 0; }
} }
$list[$types{HT}] = NonBond(0, -0.046, 0.2245) $list[$types{HT}] = NonBond(0, -0.046, 0.2245)
if ($water_dens&&($list[$types{HT}] eq "")); if ($water_dens&&($list[$types{HT}] eq ""));
$list[$types{OT}] = NonBond(0, -0.152100, 1.768200) $list[$types{OT}] = NonBond(0, -0.152100, 1.768200)
if ($water_dens&&($list[$types{OT}] eq "")); if ($water_dens&&($list[$types{OT}] eq ""));
@ -593,7 +593,7 @@
my $id = (bonds, angles, dihedrals, impropers)[$mode]; my $id = (bonds, angles, dihedrals, impropers)[$mode];
my $n = PSFGoto($id); my $n = PSFGoto($id);
my %list; my %list;
for (my $i=0; $i<$n; ++$i) for (my $i=0; $i<$n; ++$i)
{ {
my @tmp = (); my @tmp = ();
@ -624,7 +624,7 @@
{ # <PARAMETERS> { # <PARAMETERS>
my $mode = shift(@_); # bonded mode my $mode = shift(@_); # bonded mode
return if (($mode>3)||($mode<0)); return if (($mode>3)||($mode<0));
my $items = (2, 3, 4, 4)[$mode]; # items per entry my $items = (2, 3, 4, 4)[$mode]; # items per entry
my $name = ("bond", "angle", "dihedral", "improper")[$mode]; my $name = ("bond", "angle", "dihedral", "improper")[$mode];
my $read = 0; my $read = 0;
@ -691,7 +691,7 @@
} }
for (my $i=0; $i<scalar(@types); ++$i) for (my $i=0; $i<scalar(@types); ++$i)
{ {
printf("Warning: %s parameter %4d for [%s] was not found\n", printf("Warning: %s parameter %4d for [%s] was not found\n",
$name, $i+1, $types[$i]) if ($parms[$i] eq ""); $name, $i+1, $types[$i]) if ($parms[$i] eq "");
} }
} }
@ -702,7 +702,7 @@
my $id = shift(@_); my $id = shift(@_);
my $value = shift(@_); my $value = shift(@_);
my $new = ""; my $new = "";
foreach (split(":", $parms[$id])) foreach (split(":", $parms[$id]))
{ {
my @tmp = split(" "); my @tmp = split(" ");
@ -712,8 +712,8 @@
} }
$parms[$id] = $new; $parms[$id] = $new;
} }
sub CorrectDihedralParameters sub CorrectDihedralParameters
{ {
my $n = PSFGoto(dihedrals); my $n = PSFGoto(dihedrals);
@ -723,7 +723,7 @@
my $id2; my $id2;
my $first; my $first;
my $last; my $last;
for (my $i=0; $i<$n; ++$i) for (my $i=0; $i<$n; ++$i)
{ {
my @bonded = PSFGet(4); my @bonded = PSFGet(4);
@ -733,7 +733,7 @@
$first = $bonded[0]; $first = $bonded[0];
$last = $bonded[3]; $last = $bonded[3];
if ($first>$last) { my $tmp = $first; $first = $last; $last = $tmp; } if ($first>$last) { my $tmp = $first; $first = $last; $last = $tmp; }
if (($id2 = $hash{$hash_id = $first." ".$last}) eq "") if (($id2 = $hash{$hash_id = $first." ".$last}) eq "")
{ {
$hash{$hash_id} = $id1; # add id to hash $hash{$hash_id} = $id1; # add id to hash
} }
@ -757,26 +757,26 @@
} }
} }
sub AddMass sub AddMass
{ {
my $symbol = shift(@_); my $symbol = shift(@_);
my $mass = shift(@_); my $mass = shift(@_);
return if ($symbols{$symbol} ne ""); return if ($symbols{$symbol} ne "");
$ids{++$max_id} = $symbol; $ids{++$max_id} = $symbol;
$masses{$max_id} = $mass; $masses{$max_id} = $mass;
$symbols{$symbol} = $max_id; $symbols{$symbol} = $max_id;
} }
sub ReadTopology # read topology links sub ReadTopology # read topology links
{ {
my $id = shift(@_); my $id = shift(@_);
my $item = shift(@_); my $item = shift(@_);
my $read = 0; my $read = 0;
my @tmp; my @tmp;
open(TOPOLOGY, "<top_$forcefield.rtf"); open(TOPOLOGY, "<top_$forcefield.rtf");
$max_id = 0; $max_id = 0;
while (<TOPOLOGY>) while (<TOPOLOGY>)
@ -821,7 +821,7 @@
my @z = (-$L[2]/2, $L[2]/2); my @z = (-$L[2]/2, $L[2]/2);
my $n = CRDGoto(atoms); my $n = CRDGoto(atoms);
my $extremes = !($L[0] && $L[1] && $L[2]); my $extremes = !($L[0] && $L[1] && $L[2]);
@Center = (0, 0, 0); @Center = (0, 0, 0);
return if (!$n); return if (!$n);
for (my $i=0; $i<$n; ++$i) for (my $i=0; $i<$n; ++$i)
@ -858,7 +858,7 @@
my $s_OT = 1.7682; # CHARMM sigma [A] my $s_OT = 1.7682; # CHARMM sigma [A]
my $ahoh = (180-104.52)/360*PI(); my $ahoh = (180-104.52)/360*PI();
my @p = ($loh*cos($ahoh), $loh*sin($ahoh), 0); my @p = ($loh*cos($ahoh), $loh*sin($ahoh), 0);
printf("Info: creating fcc water\n") if ($info); printf("Info: creating fcc water\n") if ($info);
$n_water = 4; # molecules/cell $n_water = 4; # molecules/cell
$nav = 6.022e23; # 1/mol $nav = 6.022e23; # 1/mol
@ -867,11 +867,11 @@
@p_water = (0,0,0, @p, -$p[0],$p[1],0); @p_water = (0,0,0, @p, -$p[0],$p[1],0);
$v_fcc = $n_water*$v_water; # cell volume $v_fcc = $n_water*$v_water; # cell volume
$l_fcc = $v_fcc**(1/3); # cell length $l_fcc = $v_fcc**(1/3); # cell length
@p_fcc = (0.00,0.00,0.00, 0.50,0.50,0.00, @p_fcc = (0.00,0.00,0.00, 0.50,0.50,0.00,
0.50,0.00,0.50, 0.00,0.50,0.50); 0.50,0.00,0.50, 0.00,0.50,0.50);
@n_fcc = (); @n_fcc = ();
for (my $i=0; $i<scalar(@L); ++$i) for (my $i=0; $i<scalar(@L); ++$i)
{ {
my $n = $L[$i]/$l_fcc; # calculate n_fcc my $n = $L[$i]/$l_fcc; # calculate n_fcc
$n = int($n-int($n) ? $n+1 : $n); # ceil($n) $n = int($n-int($n) ? $n+1 : $n); # ceil($n)
$L[$i] = $n*$l_fcc; # adjust box length $L[$i] = $n*$l_fcc; # adjust box length
@ -894,18 +894,18 @@
return $x>0 ? int($x) : int($x)-1; return $x>0 ? int($x) : int($x)-1;
} }
sub Periodic sub Periodic
{ {
my @p = splice(@_, 0, 3); my @p = splice(@_, 0, 3);
return ( return (
$p[0]-floor($p[0]/$L[0]+0.5)*$L[0], $p[0]-floor($p[0]/$L[0]+0.5)*$L[0],
$p[1]-floor($p[1]/$L[1]+0.5)*$L[1], $p[1]-floor($p[1]/$L[1]+0.5)*$L[1],
$p[2]-floor($p[2]/$L[2]+0.5)*$L[2]); $p[2]-floor($p[2]/$L[2]+0.5)*$L[2]);
} }
sub EraseWater sub EraseWater
{ {
my $r = shift(@_)/2; my $r = shift(@_)/2;
@ -918,7 +918,7 @@
$p[0]+$r,$p[1]+$r,$p[2]-$r, $p[0]+$r,$p[1]+$r,$p[2]+$r); $p[0]+$r,$p[1]+$r,$p[2]-$r, $p[0]+$r,$p[1]+$r,$p[2]+$r);
my %list; my %list;
my @n; my @n;
my $d2 = ($r_water+$r)**2; my $d2 = ($r_water+$r)**2;
my @l = ($L[0]/2, $L[1]/2, $L[2]/2); my @l = ($L[0]/2, $L[1]/2, $L[2]/2);
for (my $i=0; $i<scalar(@edges); $i+=3) # determine candidates for (my $i=0; $i<scalar(@edges); $i+=3) # determine candidates
@ -946,8 +946,8 @@
$flags_fcc[$n[0]][$n[1]][$n[2]] &= $flags; # set flags $flags_fcc[$n[0]][$n[1]][$n[2]] &= $flags; # set flags
} }
} }
sub CountFCC sub CountFCC
{ {
my $n = 0; my $n = 0;
@ -964,11 +964,11 @@
return ($n_fccs = $n); return ($n_fccs = $n);
} }
sub AddIons sub AddIons
{ {
my $n = ($n_waters = CountFCC())-int(abs($net_charge)); my $n = ($n_waters = CountFCC())-int(abs($net_charge));
return if (!$ions); return if (!$ions);
printf("Warning: charge not neutralized: too little water\n") if ($n<0); printf("Warning: charge not neutralized: too little water\n") if ($n<0);
return if ($n<0); return if ($n<0);
@ -1008,7 +1008,7 @@
$flags |= $salt*(1+$salt*$na)*$bit; # set type of ion $flags |= $salt*(1+$salt*$na)*$bit; # set type of ion
} }
}; };
$bit *= 2; $bit *= 2;
} }
$flags_fcc[$x][$y][$z] = $flags; $flags_fcc[$x][$y][$z] = $flags;
} }
@ -1016,7 +1016,7 @@
} }
} }
# LAMMPS output # LAMMPS output
sub WriteLAMMPSHeader # print lammps header sub WriteLAMMPSHeader # print lammps header
@ -1053,12 +1053,12 @@
printf(PSF_CTRL "\n"); printf(PSF_CTRL "\n");
} }
sub WriteBoxSize # print box limits sub WriteBoxSize # print box limits
{ {
my @lo = V_Mult(@L[0,1,2], -1/2); my @lo = V_Mult(@L[0,1,2], -1/2);
my @hi = V_Mult(@L[0,1,2], 1/2); my @hi = V_Mult(@L[0,1,2], 1/2);
@lo = V_Add(@lo, @Center) if (!$center); @lo = V_Add(@lo, @Center) if (!$center);
@hi = V_Add(@hi, @Center) if (!$center); @hi = V_Add(@hi, @Center) if (!$center);
printf(LAMMPS "%12.8g %12.8g xlo xhi\n", $lo[0], $hi[0]); printf(LAMMPS "%12.8g %12.8g xlo xhi\n", $lo[0], $hi[0]);
@ -1066,11 +1066,11 @@
printf(LAMMPS "%12.8g %12.8g zlo zhi\n\n", $lo[2], $hi[2]); printf(LAMMPS "%12.8g %12.8g zlo zhi\n\n", $lo[2], $hi[2]);
} }
sub WriteMasses # print mass list sub WriteMasses # print mass list
{ {
my $k = 0; my $k = 0;
printf(LAMMPS "Masses\n\n"); printf(LAMMPS "Masses\n\n");
foreach (@types) foreach (@types)
{ {
@ -1132,7 +1132,7 @@
printf(PDB_CTRL "ATOM %6.6s %-4.4s %-3.3s %5.5s %3.3s ". printf(PDB_CTRL "ATOM %6.6s %-4.4s %-3.3s %5.5s %3.3s ".
"%7.7s %7.7s %7.7s %5.5s %5.5s %4.4s %s\n", $k, "%7.7s %7.7s %7.7s %5.5s %5.5s %4.4s %s\n", $k,
$types[$par[$j]-1], $n-1 ? "HOH" : "ION", $res, "", $types[$par[$j]-1], $n-1 ? "HOH" : "ION", $res, "",
$xyz[0], $xyz[1], $xyz[2], "1.00", "0.00", "", $xyz[0], $xyz[1], $xyz[2], "1.00", "0.00", "",
$n-1 ? "WATR" : "SALT") if ($pdb_ctrl); $n-1 ? "WATR" : "SALT") if ($pdb_ctrl);
printf(PSF_CTRL "%8d %4.4s %-4.4s %-4.4s %-4.4s %4.4s ". printf(PSF_CTRL "%8d %4.4s %-4.4s %-4.4s %-4.4s %4.4s ".
"%16.8e %7.7s %9.9s 0\n", $k, $n-1 ? "WATR" : "SALT", "%16.8e %7.7s %9.9s 0\n", $k, $n-1 ? "WATR" : "SALT",
@ -1154,11 +1154,11 @@
{ {
my $n = PSFGoto(atoms); my $n = PSFGoto(atoms);
my @res = (0, 0); my @res = (0, 0);
printf(PSF_CTRL "%8d !NATOM\n", $n+2*$n_waters+$n_fccs); printf(PSF_CTRL "%8d !NATOM\n", $n+2*$n_waters+$n_fccs);
while (<PSF>) while (<PSF>)
{ {
last if (!$n--); last if (!$n--);
my @psf = split(" "); my @psf = split(" ");
if ($res[1]!=$psf[2]) { ++$res[0]; $res[1] = $psf[2]; } if ($res[1]!=$psf[2]) { ++$res[0]; $res[1] = $psf[2]; }
printf(PSF_CTRL "%8d %4.4s %-4.4s %-4.4s %-4.4s %-4.4s ". printf(PSF_CTRL "%8d %4.4s %-4.4s %-4.4s %-4.4s %-4.4s ".
@ -1173,7 +1173,7 @@
my $n = PSFGoto(atoms); my $n = PSFGoto(atoms);
my $k = 0; my $k = 0;
my @res = (0, 0); my @res = (0, 0);
CRDGoto(atoms); CRDGoto(atoms);
$net_charge = 0; $net_charge = 0;
printf(LAMMPS "Atoms%s\n\n",($add ? " # full" : "")) if ($n>0); printf(LAMMPS "Atoms%s\n\n",($add ? " # full" : "")) if ($n>0);
@ -1233,7 +1233,7 @@
{ {
my @tmp = split(" "); my @tmp = split(" ");
printf(LAMMPS "%8d", ++$k); printf(LAMMPS "%8d", ++$k);
for (my $j=0; $j<$n; ++$j) { for (my $j=0; $j<$n; ++$j) {
printf(LAMMPS " %16.12g", $j<scalar(@tmp) ? $tmp[$j] : 0); } printf(LAMMPS " %16.12g", $j<scalar(@tmp) ? $tmp[$j] : 0); }
printf(LAMMPS "%s\n", $add ? " # ".$types[$i] : ""); printf(LAMMPS "%s\n", $add ? " # ".$types[$i] : "");
} }
@ -1249,7 +1249,7 @@
my $mode = shift(@_); my $mode = shift(@_);
my $k = shift(@_); my $k = shift(@_);
my $atom = $k_fcc; my $atom = $k_fcc;
return $k if (($mode>1)||!$water_dens); return $k if (($mode>1)||!$water_dens);
my $type = $mode ? CreateID(HT, OT, HT) : CreateID(HT, OT); my $type = $mode ? CreateID(HT, OT, HT) : CreateID(HT, OT);
my $id = $link{$type}; my $id = $link{$type};
@ -1266,7 +1266,7 @@
my $bit = 1; my $bit = 1;
for (my $i=0; $i<scalar(@p_fcc); $i+=3) for (my $i=0; $i<scalar(@p_fcc); $i+=3)
{ {
if ($flags&$bit) if ($flags&$bit)
{ {
if ($flags&($bit*$salt)) { ++$atom; } if ($flags&($bit*$salt)) { ++$atom; }
else else
@ -1293,7 +1293,7 @@
return $k; return $k;
} }
sub WriteBonded # print bonded list sub WriteBonded # print bonded list
{ {
my $mode = shift(@_); my $mode = shift(@_);
@ -1304,7 +1304,7 @@
my $k = 0; my $k = 0;
my @delta; my @delta;
my @tmp; my @tmp;
return 0 if ($n<1); return 0 if ($n<1);
printf(LAMMPS "%s\n\n", ucfirst($title)); printf(LAMMPS "%s\n\n", ucfirst($title));
printf(PSF_CTRL "\n%8d %s %s\n", $n+($mode ? ($mode==1 ? $n_waters : 0) printf(PSF_CTRL "\n%8d %s %s\n", $n+($mode ? ($mode==1 ? $n_waters : 0)
@ -1349,7 +1349,7 @@
return $k; return $k;
} }
sub CreateCorrectedPairCoefficients sub CreateCorrectedPairCoefficients
{ {
my $read = 0; my $read = 0;
@ -1372,8 +1372,8 @@
if (($id1 ne "")&&($id2 ne "")) if (($id1 ne "")&&($id2 ne ""))
{ {
my @c = (abs($cols[2]), $cols[3]*2.0**(-1/6)); my @c = (abs($cols[2]), $cols[3]*2.0**(-1/6));
if ($type{$id2}<$type{$id1}) if ($type{$id2}<$type{$id1})
{ {
my $tmp = $id1; $id1 = $id2; $id2 = $tmp; my $tmp = $id1; $id1 = $id2; $id2 = $tmp;
} }
$coefficients .= ":" if ($coefficients ne ""); $coefficients .= ":" if ($coefficients ne "");
@ -1386,7 +1386,7 @@
} }
} }
sub WriteData sub WriteData
{ {
open(LAMMPS, ">$project.in"); # use .in for temporary open(LAMMPS, ">$project.in"); # use .in for temporary
@ -1448,7 +1448,7 @@
printf(LAMMPS "pair_style lj/charmm/coul/long 8 12\n"); printf(LAMMPS "pair_style lj/charmm/coul/long 8 12\n");
printf(LAMMPS "pair_modify mix arithmetic\n"); printf(LAMMPS "pair_modify mix arithmetic\n");
printf(LAMMPS "kspace_style pppm 1e-6\n\n"); printf(LAMMPS "kspace_style pppm 1e-6\n\n");
if ($cmap) { if ($cmap) {
printf(LAMMPS "# Modify following line to point to the desired CMAP file\n"); printf(LAMMPS "# Modify following line to point to the desired CMAP file\n");
printf(LAMMPS "fix cmap all cmap charmm$cmap.cmap\n"); printf(LAMMPS "fix cmap all cmap charmm$cmap.cmap\n");
@ -1508,7 +1508,7 @@
# Molecular Dynamics Simulations, J. Comput. Chem. 25(2004): 1400-1415. # # Molecular Dynamics Simulations, J. Comput. Chem. 25(2004): 1400-1415. #
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
sub CharmmCmap sub CharmmCmap
{ {
print "\nINITIATING CHARMM CMAP SUBROUTINE...\n\n"; print "\nINITIATING CHARMM CMAP SUBROUTINE...\n\n";
@ -1664,7 +1664,7 @@
# ... # ...
# #
# Criteria to be a PHI/PSI dihedral pair: # Criteria to be a PHI/PSI dihedral pair:
# 1. Atoms have to match with the mass/charge constellations as # 1. Atoms have to match with the mass/charge constellations as
# defined above. # defined above.
# 2. The atoms N--CA--C needs to be covalently bonded with each # 2. The atoms N--CA--C needs to be covalently bonded with each
# other. # other.
@ -1734,7 +1734,7 @@
my $N_PRO_counter = 0; my $N_PRO_counter = 0;
my $C_flag = 0; my $C_flag = 0;
for (my $i = 0; $i <= $natom_number; $i++) { for (my $i = 0; $i <= $natom_number; $i++) {
my $cur_type = ${$atoms_matrix[$i]}[2]; my $cur_type = ${$atoms_matrix[$i]}[2];
my $cur_charge = ${$atoms_matrix[$i]}[3]; my $cur_charge = ${$atoms_matrix[$i]}[3];
@ -1777,8 +1777,8 @@
} }
# Quit if one of the atom types dosen't exist # Quit if one of the atom types dosen't exist
if ( $C_counter == 0 or if ( $C_counter == 0 or
($CA_counter == 0 and $CA_GLY_counter == 0 and $CA_PRO_counter == 0) or ($CA_counter == 0 and $CA_GLY_counter == 0 and $CA_PRO_counter == 0) or
($N_counter == 0 and $N_PRO_counter == 0) ) { ($N_counter == 0 and $N_PRO_counter == 0) ) {
if ($C_counter == 0) { if ($C_counter == 0) {
print "\nCannot find the peptide backbone C atom type\n"; print "\nCannot find the peptide backbone C atom type\n";
@ -1814,21 +1814,21 @@
my $cur_atom4_type = ${atoms_matrix[${dihedrals_matrix[$i]}[5]-1]}[2]; my $cur_atom4_type = ${atoms_matrix[${dihedrals_matrix[$i]}[5]-1]}[2];
next if (${dihedrals_matrix[$i]}[2] == ${dihedrals_matrix[$i-1]}[2] and next if (${dihedrals_matrix[$i]}[2] == ${dihedrals_matrix[$i-1]}[2] and
${dihedrals_matrix[$i]}[3] == ${dihedrals_matrix[$i-1]}[3] and ${dihedrals_matrix[$i]}[3] == ${dihedrals_matrix[$i-1]}[3] and
${dihedrals_matrix[$i]}[4] == ${dihedrals_matrix[$i-1]}[4] and ${dihedrals_matrix[$i]}[4] == ${dihedrals_matrix[$i-1]}[4] and
${dihedrals_matrix[$i]}[5] == ${dihedrals_matrix[$i-1]}[5]); ${dihedrals_matrix[$i]}[5] == ${dihedrals_matrix[$i-1]}[5]);
# Determine PHI-dihedrals; If C-CA-N-C or C-N-CA-C, then save it in a list # Determine PHI-dihedrals; If C-CA-N-C or C-N-CA-C, then save it in a list
if ($cur_atom1_type == $C_type and $cur_atom4_type == $C_type) { if ($cur_atom1_type == $C_type and $cur_atom4_type == $C_type) {
if ( ( ($cur_atom2_type == $CA_type or if ( ( ($cur_atom2_type == $CA_type or
$cur_atom2_type == $CA_GLY_type or $cur_atom2_type == $CA_GLY_type or
$cur_atom2_type == $CA_PRO_type) and $cur_atom2_type == $CA_PRO_type) and
($cur_atom3_type == $N_type or ($cur_atom3_type == $N_type or
$cur_atom3_type == $N_PRO_type) ) or $cur_atom3_type == $N_PRO_type) ) or
( ($cur_atom3_type == $CA_type or ( ($cur_atom3_type == $CA_type or
$cur_atom3_type == $CA_GLY_type or $cur_atom3_type == $CA_GLY_type or
$cur_atom3_type == $CA_PRO_type) and $cur_atom3_type == $CA_PRO_type) and
($cur_atom2_type == $N_type or ($cur_atom2_type == $N_type or
$cur_atom2_type == $N_PRO_type) ) ) { $cur_atom2_type == $N_PRO_type) ) ) {
push (@PHI_dihedrals,$cur_dihe_ID); push (@PHI_dihedrals,$cur_dihe_ID);
$PHI_counter++; $PHI_counter++;
@ -1837,17 +1837,17 @@
# Determin PSI-dihedrals; If N-CA-C-N or N-C-CA-N (N can be both normal N or N proline), # Determin PSI-dihedrals; If N-CA-C-N or N-C-CA-N (N can be both normal N or N proline),
# then save it in a list # then save it in a list
if ( ($cur_atom1_type == $N_type and $cur_atom4_type == $N_type) or if ( ($cur_atom1_type == $N_type and $cur_atom4_type == $N_type) or
($cur_atom4_type == $N_PRO_type and $cur_atom1_type == $N_PRO_type) or ($cur_atom4_type == $N_PRO_type and $cur_atom1_type == $N_PRO_type) or
($cur_atom1_type == $N_type and $cur_atom4_type == $N_PRO_type) or ($cur_atom1_type == $N_type and $cur_atom4_type == $N_PRO_type) or
($cur_atom4_type == $N_type and $cur_atom1_type == $N_PRO_type) ) { ($cur_atom4_type == $N_type and $cur_atom1_type == $N_PRO_type) ) {
if ( ( ($cur_atom2_type == $CA_type or if ( ( ($cur_atom2_type == $CA_type or
$cur_atom2_type == $CA_GLY_type or $cur_atom2_type == $CA_GLY_type or
$cur_atom2_type == $CA_PRO_type) and $cur_atom2_type == $CA_PRO_type) and
$cur_atom3_type == $C_type) or $cur_atom3_type == $C_type) or
( ($cur_atom3_type == $CA_type or ( ($cur_atom3_type == $CA_type or
$cur_atom3_type == $CA_GLY_type or $cur_atom3_type == $CA_GLY_type or
$cur_atom3_type == $CA_PRO_type) and $cur_atom3_type == $CA_PRO_type) and
$cur_atom2_type == $C_type) ) { $cur_atom2_type == $C_type) ) {
push (@PSI_dihedrals,$cur_dihe_ID); push (@PSI_dihedrals,$cur_dihe_ID);
$PSI_counter++; $PSI_counter++;
@ -1871,7 +1871,7 @@
# #
# The algorithm: # The algorithm:
# _____ # _____
# | | # | |
# 1--2--3--4 PHI-dihedral # 1--2--3--4 PHI-dihedral
# 4--3--2--1 # 4--3--2--1
# --C--N-CA--C--N-- Peptide backbone # --C--N-CA--C--N-- Peptide backbone
@ -1887,7 +1887,7 @@
# if (2--3--4) = (4--3--2) # if (2--3--4) = (4--3--2)
# or # or
# if (3--2--1) = (1--2--3) # if (3--2--1) = (1--2--3)
# or # or
# if (3--2--1) = (4--3--2), # if (3--2--1) = (4--3--2),
# #
# then these 2 dihedrals are a PHI/PSI pair. If a pair is found, the # then these 2 dihedrals are a PHI/PSI pair. If a pair is found, the
@ -1940,7 +1940,7 @@
if ($crossterm_CA_charge == $charge_CA) { $crossterm_type = 1; $crossterm_type1_flag = 1; } if ($crossterm_CA_charge == $charge_CA) { $crossterm_type = 1; $crossterm_type1_flag = 1; }
if ($crossterm_CA_charge == $charge_CA_GLY) { $crossterm_type = 5; $crossterm_type5_flag = 1; } if ($crossterm_CA_charge == $charge_CA_GLY) { $crossterm_type = 5; $crossterm_type5_flag = 1; }
if ($crossterm_CA_charge == $charge_CA_PRO) { if ($crossterm_CA_charge == $charge_CA_PRO) {
$crossterm_type = 3; $crossterm_type3_flag = 1; $crossterm_type = 3; $crossterm_type3_flag = 1;
# Checking the last crossterm, re-assign the last crossterm type if needed # Checking the last crossterm, re-assign the last crossterm type if needed
if ($crossterm_counter-1 >= 0 and $PHI_PSI_matrix[$crossterm_counter-1][0] == 1) { if ($crossterm_counter-1 >= 0 and $PHI_PSI_matrix[$crossterm_counter-1][0] == 1) {
@ -1998,7 +1998,7 @@
print "acid abbreviation for that amino acid, and <#2> is the molecule number\n"; print "acid abbreviation for that amino acid, and <#2> is the molecule number\n";
print "of the terminal amino acid residue.\n\n"; print "of the terminal amino acid residue.\n\n";
print "For example, if the last atom of the last amino acid in the peptide\n"; print "For example, if the last atom of the last amino acid in the peptide\n";
print "sequence is listed in the pdb file as:\n\n"; print "sequence is listed in the pdb file as:\n\n";
print " 'ATOM 853 O GLU P 56 12.089 -1.695 -6.543 1.00 1.03 PROA'\n\n"; print " 'ATOM 853 O GLU P 56 12.089 -1.695 -6.543 1.00 1.03 PROA'\n\n";
print "you would insert the following line after it:\n\n"; print "you would insert the following line after it:\n\n";
print " 'TER 854 GLU 56'\n\n"; print " 'TER 854 GLU 56'\n\n";
@ -2016,7 +2016,7 @@
# Print out PHI/PSI diheral pair list # Print out PHI/PSI diheral pair list
my $pair_counter = 0; my $pair_counter = 0;
# Don't presently use $ncrosstermtypes but have this available if wish to print it out # Don't presently use $ncrosstermtypes but have this available if wish to print it out
my $ncrosstermtypes = $crossterm_type1_flag + $crossterm_type2_flag + $crossterm_type3_flag + my $ncrosstermtypes = $crossterm_type1_flag + $crossterm_type2_flag + $crossterm_type3_flag +
$crossterm_type4_flag + $crossterm_type5_flag + $crossterm_type6_flag; $crossterm_type4_flag + $crossterm_type5_flag + $crossterm_type6_flag;
print "\nWriting \"$project.data\" with section \"CMAP crossterms\" added at the end.\n"; print "\nWriting \"$project.data\" with section \"CMAP crossterms\" added at the end.\n";

View File

@ -8,9 +8,9 @@
# conjunction with vmd # conjunction with vmd
# #
# Notes: Copyright by author for Sandia National Laboratories # Notes: Copyright by author for Sandia National Laboratories
# 20040903 Conception date of v1.0: rudimentary script for collagen # 20040903 Conception date of v1.0: rudimentary script for collagen
# project. # project.
# 20050423 Conception date of v2.0: # 20050423 Conception date of v2.0:
# - changed data access through indexing data directly on disk; # - changed data access through indexing data directly on disk;
# - added all command line options # - added all command line options
# 20050425 Corrected focussing to use a target molecule's moment of # 20050425 Corrected focussing to use a target molecule's moment of
@ -22,21 +22,21 @@
# the data stream. # the data stream.
# subroutines # subroutines
sub test sub test
{ {
my $name = shift(@_); my $name = shift(@_);
printf("Error: file %s not found\n", $name) if (!scalar(stat($name))); printf("Error: file %s not found\n", $name) if (!scalar(stat($name)));
return !scalar(stat($name)); return !scalar(stat($name));
} }
sub initialize sub initialize
{ {
my $k = 0; my $k = 0;
my @options = ("-help", "-nstart", "-dn", "-cut", "-repair", my @options = ("-help", "-nstart", "-dn", "-cut", "-repair",
"-units", "-quiet", "-nodetect", "-data", "-pbc", "-units", "-quiet", "-nodetect", "-data", "-pbc",
"-focus", "-center", "-exclude"); "-focus", "-center", "-exclude");
my @remarks = ("display this message", my @remarks = ("display this message",
"starting frame [-1]", "starting frame [-1]",
@ -61,7 +61,7 @@
"* Expected files in current directory: project.data, project.dump", "* Expected files in current directory: project.data, project.dump",
"* Generated output files: project_trj.psf, project_trj.pdb", "* Generated output files: project_trj.psf, project_trj.pdb",
"* Uses project_ctrl.psf if available"); "* Uses project_ctrl.psf if available");
$program = "lammps2pdb"; $program = "lammps2pdb";
$version = "2.2.5"; $version = "2.2.5";
@ -96,7 +96,7 @@
$info = $switch ? 0 : 1 if (!$k--); $info = $switch ? 0 : 1 if (!$k--);
$detect = $switch ? 0 : 1 if (!$k--); $detect = $switch ? 0 : 1 if (!$k--);
$data_name = $arg[1] if (!$k--); $data_name = $arg[1] if (!$k--);
if (!$k--) { if (!$k--) {
if ($switch) { $pbc{ALL} = 1; } if ($switch) { $pbc{ALL} = 1; }
else { foreach (split(",",$arg[1])) { $pbc{uc($_)} = 1; }}} else { foreach (split(",",$arg[1])) { $pbc{uc($_)} = 1; }}}
if (!$k--) { foreach (split(",",$arg[1])) { $focus{uc($_)} = uc($_);}} if (!$k--) { foreach (split(",",$arg[1])) { $focus{uc($_)} = uc($_);}}
@ -120,7 +120,7 @@
printf("\n"); printf("\n");
exit(-1); exit(-1);
} }
printf("%s v%s (c)%s\n\n", $program, $version, $year) if ($info); printf("%s v%s (c)%s\n\n", $program, $version, $year) if ($info);
$data_name = $project.".data" if ($data_name eq ""); $data_name = $project.".data" if ($data_name eq "");
$traject_name = $project.".dump"; $traject_name = $project.".dump";
@ -133,7 +133,7 @@
my $flag = test($data_name); my $flag = test($data_name);
printf("Conversion aborted\n\n") if ($flag); printf("Conversion aborted\n\n") if ($flag);
exit(-1) if ($flag); exit(-1) if ($flag);
# data input # data input
create_atom_ids(); create_atom_ids();
@ -145,9 +145,9 @@
open(PSF, ">".$psf_name) if (!$psf_ctrl); open(PSF, ">".$psf_name) if (!$psf_ctrl);
open(PDB, ">".$pdb_name); open(PDB, ">".$pdb_name);
# align center with focus # align center with focus
%center = %focus if (scalar(%focus)); %center = %focus if (scalar(%focus));
} }
@ -166,24 +166,24 @@
return @_; return @_;
} }
sub V_Add # V_Add(@a, @b) = @a + @b; sub V_Add # V_Add(@a, @b) = @a + @b;
{ {
return (@_[0]+@_[3], @_[1]+@_[4], @_[2]+@_[5]); return (@_[0]+@_[3], @_[1]+@_[4], @_[2]+@_[5]);
} }
sub V_Subtr # V_Subtr(@a, @b) = @a - @b; sub V_Subtr # V_Subtr(@a, @b) = @a - @b;
{ {
return (@_[0]-@_[3], @_[1]-@_[4], @_[2]-@_[5]); return (@_[0]-@_[3], @_[1]-@_[4], @_[2]-@_[5]);
} }
sub V_Dot # V_Dot(@a, @b) = @a . @b; sub V_Dot # V_Dot(@a, @b) = @a . @b;
{ {
return (@_[0]*@_[3]+@_[1]*@_[4]+@_[2]*@_[5]); return (@_[0]*@_[3]+@_[1]*@_[4]+@_[2]*@_[5]);
} }
sub V_Cross # V_Cross(@a, @b) = @a x @b; sub V_Cross # V_Cross(@a, @b) = @a x @b;
{ {
@ -191,7 +191,7 @@
@_[0]*@_[4]-@_[1]*@_[3]); @_[0]*@_[4]-@_[1]*@_[3]);
} }
sub V_Mult # V_Mult($f, @a) = $f * @a; sub V_Mult # V_Mult($f, @a) = $f * @a;
{ {
return (@_[0]*@_[1], @_[0]*@_[2], @_[0]*@_[3]); return (@_[0]*@_[1], @_[0]*@_[2], @_[0]*@_[3]);
@ -203,11 +203,11 @@
return V_Mult(1/sqrt(V_Dot(@_[0,1,2],@_[0,1,2])), @_[0,1,2]); return V_Mult(1/sqrt(V_Dot(@_[0,1,2],@_[0,1,2])), @_[0,1,2]);
} }
sub pbc # periodic -0.5*L <= x < 0.5*L sub pbc # periodic -0.5*L <= x < 0.5*L
{ {
my $x = @_[0]/@_[1]+0.5; my $x = @_[0]/@_[1]+0.5;
return @_[0]-@_[1]*($x<0 ? int($x)-1 : int($x)); return @_[0]-@_[1]*($x<0 ? int($x)-1 : int($x));
} }
@ -216,8 +216,8 @@
{ {
return (pbc(@_[0], @_[3]), pbc(@_[1], @_[4]), pbc(@_[2], @_[5])); return (pbc(@_[0], @_[3]), pbc(@_[1], @_[4]), pbc(@_[2], @_[5]));
} }
sub V_Cmp # V_Cmp(abs(@a), abs(@b)) sub V_Cmp # V_Cmp(abs(@a), abs(@b))
{ {
return -1 if (abs($_[0])<abs($_[3])); return -1 if (abs($_[0])<abs($_[3]));
@ -228,12 +228,12 @@
return 1 if (abs($_[2])>abs($_[5])); return 1 if (abs($_[2])>abs($_[5]));
return 0; return 0;
} }
sub V_Sort # sort on descending absolute sub V_Sort # sort on descending absolute
{ # value { # value
my @v = @_; my @v = @_;
for (my $i=0; $i<scalar(@v)-3; $i+=3) for (my $i=0; $i<scalar(@v)-3; $i+=3)
{ {
for (my $j=$i+3; $j<scalar(@v); $j+=3) for (my $j=$i+3; $j<scalar(@v); $j+=3)
@ -247,13 +247,13 @@
return @v; return @v;
} }
# Matrix routines # Matrix routines
sub M_String # M_String(@A) sub M_String # M_String(@A)
{ {
my @M; my @M;
for (my $i=0; $i<3; ++$i) { push(@M, V_String(splice(@_, 0, 3))); } for (my $i=0; $i<3; ++$i) { push(@M, V_String(splice(@_, 0, 3))); }
return "{".join(", ", @M)."}"; return "{".join(", ", @M)."}";
} }
@ -270,7 +270,7 @@
return (@_[0], @_[3], @_[6], @_[1], @_[4], @_[7], @_[2], @_[5], @_[8]); return (@_[0], @_[3], @_[6], @_[1], @_[4], @_[7], @_[2], @_[5], @_[8]);
} }
sub M_Dot # M_Dot(@A, @B) = @A . @B; sub M_Dot # M_Dot(@A, @B) = @A . @B;
{ {
return ( return (
@ -288,7 +288,7 @@
return V_Dot(@_[0,1,2], V_Cross(@_[3,4,5], @_[6,7,8])); return V_Dot(@_[0,1,2], V_Cross(@_[3,4,5], @_[6,7,8]));
} }
sub M_Mult # M_Mult($a, @A) = $a * @A sub M_Mult # M_Mult($a, @A) = $a * @A
{ {
return ( return (
@ -296,12 +296,12 @@
@_[0]*@_[4], @_[0]*@_[5], @_[0]*@_[6], @_[0]*@_[4], @_[0]*@_[5], @_[0]*@_[6],
@_[0]*@_[7], @_[0]*@_[8], @_[0]*@_[9]); @_[0]*@_[7], @_[0]*@_[8], @_[0]*@_[9]);
} }
sub M_Unit { return (1,0,0, 0,1,0, 0,0,1); } sub M_Unit { return (1,0,0, 0,1,0, 0,0,1); }
sub PI { return 4*atan2(1,1); } sub PI { return 4*atan2(1,1); }
sub M_Rotate # M_Rotate($n, $alpha) = @R_$n; sub M_Rotate # M_Rotate($n, $alpha) = @R_$n;
{ # vmd convention { # vmd convention
my $n = shift(@_); my $n = shift(@_);
@ -316,7 +316,7 @@
return ($cos,-$sin,0, $sin,$cos,0, 0,0,1) if ($n==2); # around z-axis return ($cos,-$sin,0, $sin,$cos,0, 0,0,1) if ($n==2); # around z-axis
return M_Unit(); return M_Unit();
} }
sub M_RotateNormal # returns R.(1,0,0) = @a/|@a|; sub M_RotateNormal # returns R.(1,0,0) = @a/|@a|;
{ {
@ -324,7 +324,7 @@
my @n = V_Mult(1.0/sqrt(V_Dot(@_[0,1,2], @_)), @_); my @n = V_Mult(1.0/sqrt(V_Dot(@_[0,1,2], @_)), @_);
my $sina = $n[1]<0 ? -sqrt($n[1]*$n[1]+$n[2]*$n[2]) : my $sina = $n[1]<0 ? -sqrt($n[1]*$n[1]+$n[2]*$n[2]) :
sqrt($n[1]*$n[1]+$n[2]*$n[2]); sqrt($n[1]*$n[1]+$n[2]*$n[2]);
if ($sina) if ($sina)
{ {
my $cosa = $n[0]; my $cosa = $n[0];
@ -337,8 +337,8 @@
} }
return @R; return @R;
} }
sub MV_Dot # MV_Dot(@A, @b) = @A . @b; sub MV_Dot # MV_Dot(@A, @b) = @A . @b;
{ {
return (V_Dot(@_[0,1,2], @_[9,10,11]), V_Dot(@_[3,4,5], @_[9,10,11]), return (V_Dot(@_[0,1,2], @_[9,10,11]), V_Dot(@_[3,4,5], @_[9,10,11]),
@ -374,14 +374,14 @@
{ {
return (@_[0]+@_[2], @_[1]+@_[3]); return (@_[0]+@_[2], @_[1]+@_[3]);
} }
sub C_Subtr # z = z1 - z2 sub C_Subtr # z = z1 - z2
{ {
return (@_[0]-@_[2], @_[1]-@_[3]); return (@_[0]-@_[2], @_[1]-@_[3]);
} }
sub C_Mult # z = z1 * z2 sub C_Mult # z = z1 * z2
{ {
return (@_[0]*@_[2]-@_[1]*@_[3], @_[0]*@_[3]+@_[2]*@_[1]); return (@_[0]*@_[2]-@_[1]*@_[3], @_[0]*@_[3]+@_[2]*@_[1]);
@ -404,7 +404,7 @@
return ($r*cos($a), $r*sin($a)); return ($r*cos($a), $r*sin($a));
} }
sub C_Correct sub C_Correct
{ {
return (abs(@_[0])<1e-14 ? 0 : @_[0], abs(@_[1])<1e-14 ? 0 : @_[1]); return (abs(@_[0])<1e-14 ? 0 : @_[0], abs(@_[1])<1e-14 ? 0 : @_[1]);
@ -422,7 +422,7 @@
return (@_[0], -@_[1]); return (@_[0], -@_[1]);
} }
sub C_String sub C_String
{ {
return @_[0]." + ".@_[1]."i"; return @_[0]." + ".@_[1]."i";
@ -434,12 +434,12 @@
sub R_Sort sub R_Sort
{ {
my $n = scalar(@_); my $n = scalar(@_);
for (my $i=0; $i<$n-2; $i+=2) for (my $i=0; $i<$n-2; $i+=2)
{ {
for (my $j=$i+2; $j<$n; $j+=2) for (my $j=$i+2; $j<$n; $j+=2)
{ {
if (@_[$j]<@_[$i]) { if (@_[$j]<@_[$i]) {
my @t = @_[$i,$i+1]; @_[$i,$i+1] = @_[$j,$j+1]; @_[$j,$j+1] = @t; } my @t = @_[$i,$i+1]; @_[$i,$i+1] = @_[$j,$j+1]; @_[$j,$j+1] = @t; }
else { if ((@_[$j]==@_[$i])&&(@_[$j+1]<@_[$i+1])) { else { if ((@_[$j]==@_[$i])&&(@_[$j+1]<@_[$i+1])) {
my @t = @_[$i,$i+1]; @_[$i,$i+1] = @_[$j,$j+1]; @_[$j,$j+1] = @t; } } my @t = @_[$i,$i+1]; @_[$i,$i+1] = @_[$j,$j+1]; @_[$j,$j+1] = @t; } }
@ -448,7 +448,7 @@
return @_; return @_;
} }
sub R_First sub R_First
{ {
return (0, 0) if (abs(@_[1])<1e-14); return (0, 0) if (abs(@_[1])<1e-14);
@ -476,16 +476,16 @@
my @B = (0, 0); my @B = (0, 0);
my @z1 = (0.5, 0.5*sqrt(3)); my @z1 = (0.5, 0.5*sqrt(3));
my @z2 = C_Conj(@z1); my @z2 = C_Conj(@z1);
if (abs($f1)<1e-3) { # limit f1 -> 0 if (abs($f1)<1e-3) { # limit f1 -> 0
@A = ($f2<0 ? abs(2*$f2)**(1/3) : 0, 0); } @A = ($f2<0 ? abs(2*$f2)**(1/3) : 0, 0); }
else { else {
if (abs($f2)<1e-14) { # limit f2 -> 0 if (abs($f2)<1e-14) { # limit f2 -> 0
my $f = sqrt(abs($f1))/$c3; my $f = sqrt(abs($f1))/$c3;
@A = $f1<0 ? (-$f*$z1[1], 0.5*$f) : ($f, 0); @A = $f1<0 ? (-$f*$z1[1], 0.5*$f) : ($f, 0);
@B = $f1<0 ? (-$A[0], $A[1]) : ($f, 0); } @B = $f1<0 ? (-$A[0], $A[1]) : ($f, 0); }
else { else {
@B = C_Pow(C_Add(($f2, 0), @B = C_Pow(C_Add(($f2, 0),
C_Pow(($f1*$f1*$f1+$f2*$f2, 0), 1/2)), 1/3); C_Pow(($f1*$f1*$f1+$f2*$f2, 0), 1/2)), 1/3);
@A = C_Div(($f1/$c3, 0), @B); @A = C_Div(($f1/$c3, 0), @B);
@B = ($B[0]/$c3, $B[1]/$c3); } } @B = ($B[0]/$c3, $B[1]/$c3); } }
@ -503,21 +503,21 @@
my $input = shift; my $input = shift;
my $dlines = shift; my $dlines = shift;
my $read; my $read;
while ($dlines--) { $read = <$input>; } while ($dlines--) { $read = <$input>; }
return $read; return $read;
} }
sub rewind_read sub rewind_read
{ {
my $input = shift; my $input = shift;
seek($input, 0, SEEK_SET); seek($input, 0, SEEK_SET);
} }
# create crossreference tables # create crossreference tables
sub create_psf_index # make an index of id sub create_psf_index # make an index of id
{ # locations { # locations
@ -538,13 +538,13 @@
} }
} }
sub psf_goto # goto $ident in <PSF> sub psf_goto # goto $ident in <PSF>
{ {
create_psf_index() if (!scalar(%PSFIndex)); create_psf_index() if (!scalar(%PSFIndex));
my $id = shift(@_); my $id = shift(@_);
my @n = split(" ", $PSFIndex{$id}); my @n = split(" ", $PSFIndex{$id});
@PSFBuffer = (); @PSFBuffer = ();
if (!scalar(@n)) if (!scalar(@n))
{ {
@ -571,7 +571,7 @@
my $id; my $id;
my %hash; my %hash;
my %size; my %size;
foreach ((masses,atoms,bonds,angles,dihedrals,impropers)) { $hash{$_}=$_; } foreach ((masses,atoms,bonds,angles,dihedrals,impropers)) { $hash{$_}=$_; }
open(DATA, "<".$data_name); open(DATA, "<".$data_name);
for (my $i=0; $i<2; ++$i) { my $tmp = <DATA>; } # skip first two lines for (my $i=0; $i<2; ++$i) { my $tmp = <DATA>; } # skip first two lines
@ -604,7 +604,7 @@
} }
} }
sub goto_data sub goto_data
{ {
create_data_index() if (!scalar(%DATAIndex)); create_data_index() if (!scalar(%DATAIndex));
@ -623,7 +623,7 @@
# create atom and residue identifiers # create atom and residue identifiers
sub create_names sub create_names
{ {
return if (scalar(@names)); return if (scalar(@names));
@ -636,7 +636,7 @@
my @letter = ("X", "Y", "Z", "P", "Q", "R", "S", "A", "B", "C"); my @letter = ("X", "Y", "Z", "P", "Q", "R", "S", "A", "B", "C");
my $k = 0; my $k = 0;
my %atom; my %atom;
$names[0] = ""; $names[0] = "";
foreach (@mass) { $atom{$_} = shift(@name); } foreach (@mass) { $atom{$_} = shift(@name); }
for (my $i=1; $i<=$n; ++$i) for (my $i=1; $i<=$n; ++$i)
@ -658,7 +658,7 @@
my @data = @_; my @data = @_;
my $p = $data[1]." ".$data[2]; my $p = $data[1]." ".$data[2];
my $k; my $k;
for ($k=0; ($k<scalar(@data))&&(substr($data[$k],0,1) ne "#"); ++$k) { } for ($k=0; ($k<scalar(@data))&&(substr($data[$k],0,1) ne "#"); ++$k) { }
@data = splice(@data, $k-($k<8 ? 3 : 6), $k<8 ? 3 : 6); @data = splice(@data, $k-($k<8 ? 3 : 6), $k<8 ? 3 : 6);
foreach (@L) foreach (@L)
@ -669,8 +669,8 @@
} }
return $p; return $p;
} }
sub create_atom_ids sub create_atom_ids
{ {
my $res = 0; my $res = 0;
@ -682,7 +682,7 @@
my $id; my $id;
my %link; my %link;
my %special; my %special;
printf("Info: creating atom ids\n") if ($info); printf("Info: creating atom ids\n") if ($info);
create_names(); create_names();
$n = goto_data(atoms); $n = goto_data(atoms);
@ -696,8 +696,8 @@
{ {
if ((($tmp = $link{$id = join(" ", sort(split(" ", $id)))}) eq "")&& if ((($tmp = $link{$id = join(" ", sort(split(" ", $id)))}) eq "")&&
(($tmp = $special{$id}) eq "")) (($tmp = $special{$id}) eq ""))
{ {
$link{$id} = $link{$id} =
$tmp = "R".($res<10 ? "0" : "").$res; $tmp = "R".($res<10 ? "0" : "").$res;
++$res; ++$res;
} }
@ -712,12 +712,12 @@
} }
} }
sub crossover sub crossover
{ {
my @d = V_Subtr((split(" ", $position[@_[0]]))[0,1,2], my @d = V_Subtr((split(" ", $position[@_[0]]))[0,1,2],
(split(" ", $position[@_[1]]))[0,1,2]); (split(" ", $position[@_[1]]))[0,1,2]);
$d[0] /= $l[3]; $d[0] /= $l[3];
$d[1] /= $l[4]; $d[1] /= $l[4];
$d[2] /= $l[5]; $d[2] /= $l[5];
@ -744,7 +744,7 @@
{ {
my $n = scalar(@bonds); my $n = scalar(@bonds);
my $i = 0; my $i = 0;
printf("Info: deleting excluded bonds\n") if ($info); printf("Info: deleting excluded bonds\n") if ($info);
while ($i<$n) while ($i<$n)
{ {
@ -754,12 +754,12 @@
else { ++$i; } else { ++$i; }
} }
} }
sub create_bonds sub create_bonds
{ {
my $n = goto_data(bonds); my $n = goto_data(bonds);
printf("Info: creating bonds\n") if ($info); printf("Info: creating bonds\n") if ($info);
for (my $i=0; $i<$n; ++$i) for (my $i=0; $i<$n; ++$i)
{ {
@ -779,20 +779,20 @@
while (!eof(TRAJECT)&&(substr(lc(join(" ", split(" ", <TRAJECT>))), while (!eof(TRAJECT)&&(substr(lc(join(" ", split(" ", <TRAJECT>))),
0,length($subject)) ne $subject)) {} 0,length($subject)) ne $subject)) {}
} }
sub read_traject sub read_traject
{ {
my @box; my @box;
my @l; my @l;
advance_traject("timestep"); advance_traject("timestep");
my $timestep = (split(" ", <TRAJECT>))[0]; my $timestep = (split(" ", <TRAJECT>))[0];
advance_traject("number of atoms"); advance_traject("number of atoms");
my $n = (split(" ", <TRAJECT>))[0]; my $n = (split(" ", <TRAJECT>))[0];
advance_traject("box bounds"); advance_traject("box bounds");
for (my $i=0; $i<3; ++$i) for (my $i=0; $i<3; ++$i)
{ {
my @data = split(" ", <TRAJECT>); my @data = split(" ", <TRAJECT>);
$box[$i] = $data[0]; # box edge $box[$i] = $data[0]; # box edge
$l[$i] = $data[1]-$data[0]; # box length $l[$i] = $data[1]-$data[0]; # box length
@ -806,9 +806,9 @@
return ($timestep, $n, @box, @l); return ($timestep, $n, @box, @l);
} }
# pdb format # pdb format
sub eigen_vector # eigen_vector(@A, $l) sub eigen_vector # eigen_vector(@A, $l)
{ {
my @A = splice(@_,0,9); my @A = splice(@_,0,9);
@ -826,8 +826,8 @@
return (0,0,1) if ($A[8]==1); return (0,0,1) if ($A[8]==1);
return (0,0,0); return (0,0,0);
} }
sub pdb_inertia sub pdb_inertia
{ {
my @s = ( my @s = (
@ -852,13 +852,13 @@
M_Transpose(M_RotateNormal(MV_Dot(@A,@b)))); M_Transpose(M_RotateNormal(MV_Dot(@A,@b))));
return M_Dot(@B, @A); return M_Dot(@B, @A);
} }
sub pdb_focus # using moment of inertia sub pdb_focus # using moment of inertia
{ {
my @R = pdb_inertia(@_); my @R = pdb_inertia(@_);
printf("Info: focussing\n") if ($info); printf("Info: focussing\n") if ($info);
foreach (@position) foreach (@position)
{ {
@ -867,7 +867,7 @@
} }
} }
sub pdb_center sub pdb_center
{ {
my @c = splice(@_, 0, 3); my @c = splice(@_, 0, 3);
@ -881,7 +881,7 @@
} }
} }
sub pdb_pbc sub pdb_pbc
{ {
printf("Info: applying periodicity\n") if ($info); printf("Info: applying periodicity\n") if ($info);
@ -909,7 +909,7 @@
} }
} }
sub pdb_positions sub pdb_positions
{ {
my @m = (0,0,0,0,0,0,0,0,0); my @m = (0,0,0,0,0,0,0,0,0);
@ -918,7 +918,7 @@
my $mass; my $mass;
my @p; my @p;
my $d; my $d;
foreach (@traject) foreach (@traject)
{ {
my @arg = split(" "); my @arg = split(" ");
@ -974,7 +974,7 @@
printf(PDB "%-11.11s", "P 1"); printf(PDB "%-11.11s", "P 1");
printf(PDB "%3.3s\n", "1"); printf(PDB "%3.3s\n", "1");
} }
sub pdb_atoms sub pdb_atoms
{ {
@ -998,15 +998,15 @@
foreach (@p) { $_ = 0 if (abs($_)<1e-4); } foreach (@p) { $_ = 0 if (abs($_)<1e-4); }
printf(PDB "ATOM "); # pdb command printf(PDB "ATOM "); # pdb command
printf(PDB "%6.6s ", ++$n); # atom number printf(PDB "%6.6s ", ++$n); # atom number
printf(PDB "%-3.3s ", printf(PDB "%-3.3s ",
$psf_ctrl ? $psf[4] : $names[$p[4]]); # atom name $psf_ctrl ? $psf[4] : $names[$p[4]]); # atom name
printf(PDB "%-3.3s ", printf(PDB "%-3.3s ",
$psf_ctrl ? $psf[3] : $residue[$nres]); # residue name $psf_ctrl ? $psf[3] : $residue[$nres]); # residue name
printf(PDB "%5.5s ", $nres); # residue number printf(PDB "%5.5s ", $nres); # residue number
printf(PDB "%3.3s ", ""); # empty placeholder printf(PDB "%3.3s ", ""); # empty placeholder
printf(PDB "%7.7s %7.7s %7.7s ", printf(PDB "%7.7s %7.7s %7.7s ",
$p[0], $p[1], $p[2]); # positions $p[0], $p[1], $p[2]); # positions
printf(PDB "%5.5s %5.5s %4.4s ", printf(PDB "%5.5s %5.5s %4.4s ",
"1.00", "0.00", ""); # trailing variables "1.00", "0.00", ""); # trailing variables
printf(PDB "%-4.4s\n", printf(PDB "%-4.4s\n",
$psf_ctrl ? $psf[1] : $cluster[$nres]); # cluster name $psf_ctrl ? $psf[1] : $cluster[$nres]); # cluster name
@ -1015,7 +1015,7 @@
}; };
printf(PDB "END\n"); printf(PDB "END\n");
} }
sub pdb_timestep sub pdb_timestep
{ {
@ -1045,7 +1045,7 @@
my $l = 0; my $l = 0;
my $k = 0; my $k = 0;
my @extra; my @extra;
for (my $i=0; $i<$n; ++$i) for (my $i=0; $i<$n; ++$i)
{ {
my @arg = split(" ", <DATA>); my @arg = split(" ", <DATA>);
@ -1073,13 +1073,13 @@
} }
printf(PSF "\n"); printf(PSF "\n");
} }
sub psf_bonds sub psf_bonds
{ {
my $npairs = 0; my $npairs = 0;
delete_exclude() if (scalar(%exclude)>0); delete_exclude() if (scalar(%exclude)>0);
delete_crossovers() if ($cut); delete_crossovers() if ($cut);
printf(PSF "%8.8s !NBOND\n", scalar(@bonds)); printf(PSF "%8.8s !NBOND\n", scalar(@bonds));
foreach (@bonds) foreach (@bonds)
@ -1098,7 +1098,7 @@
initialize(); initialize();
# create .pdb file # create .pdb file
$ncurrent = -1; $ncurrent = -1;
while ($traject_flag&&!eof(TRAJECT)) while ($traject_flag&&!eof(TRAJECT))
{ {
@ -1134,4 +1134,4 @@
close(TRAJECT); close(TRAJECT);
close(DATA); close(DATA);