Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #
- #VR
- #
- #
- use Data::Dumper qw(Dumper);
- #duomenis isskaityt is out failo:
- my $file = '4HTOconstrObigfragtrim_LCD_VK.out';
- open my $info, $file or die "Could not open $file: $!";
- while( my $line = <$info>) {
- #print $line;
- push @orbital_line, $line if ($line =~ "^ ORBITAL [ 0-9]");
- $toliau_eina_mat=1 if ($line =~ " INTRA- AND INTER-LCD ENERGY");
- push @mat_line, $line if ($toliau_eina_mat == 1 && $line =~ "^ [ 0-9][ 0-9][0-9]");
- }
- #dabar sudaryti matrica uzpildyta orbitaliu numeriais x atomo nr. ir y jo orbitales eiles nr. nuo 0,1,...
- foreach $orb (@orbital_line) {
- chop $orb;
- #print "$orb";
- @orb_words = split(/ +/, $orb);
- #print " so $orb_words[2] $orb_words[6] $orb_words[8] $orb_words[10]\n";
- push @{$atom[$orb_words[6]]}, $orb_words[2] if ($orb_words[6] > 0);
- push @{$atom[$orb_words[8]]}, $orb_words[2] if ($orb_words[8] > 0);
- push @{$atom[$orb_words[10]]}, $orb_words[2] if ($orb_words[10] > 0);
- }
- #print "primo atomo orbitales:\n";
- #print Dumper \@atom[1];
- #dabar sutvarkyti matrica orbitaliu saveiku energiju $orbital_interaction
- foreach $mat (@mat_line) {
- chop $mat;
- #print "$mat";
- @mat_numbers = split(/ +/, $mat);
- #print " so $mat_numbers[2] $mat_numbers[3] $mat_numbers[4] $mat_numbers[5] $mat_numbers[6]\n";
- #mat_numbers[1] yra orbitales numeriai
- $mat_numbers[1]--;
- push @{$orbital_interaction[$mat_numbers[1]]}, $mat_numbers[2];
- push @{$orbital_interaction[$mat_numbers[1]]}, $mat_numbers[3];
- push @{$orbital_interaction[$mat_numbers[1]]}, $mat_numbers[4];
- push @{$orbital_interaction[$mat_numbers[1]]}, $mat_numbers[5];
- push @{$orbital_interaction[$mat_numbers[1]]}, $mat_numbers[6];
- }
- #print "test orbital interaction: $orbital_interaction[158][158]\n";
- #dabar jau orbitales sunumeruotos nuo 0!!!
- ##tada:
- ##visu atomu saveika su visais kitais:
- $a = 1;
- while (@{ $atom[$a] }) {
- $x = 1;
- while (@{ $atom[$x] }) {
- foreach $orba (@{ $atom[$a] }) { #per visas a atomo orbitales
- foreach $orbb (@{ $atom[$x] }) { #per visas x atomo orbitales
- #print "orba $orba orbb $orbb";
- $atom_interaction[$a][$x]+=$orbital_interaction[$orba-1][$orbb-1];
- }
- }
- $x++;
- }
- $a++;
- }
- #print "Energijos suma atomu poroms:";
- #print Dumper \@atom_interaction;
- #print "77 su 78 0.5722..: $atom_interaction[77][78] OK"
- #dabar rasti mix/max, bet pats atomas su savim netinka
- $x=1;
- $min{'eng'}=0;
- $max{'eng'}=0;
- #tik pirmus 12 su kitais imti:
- #while (@{ $atom_interaction[$x] }) {
- while ($x < 13) {
- $y = 13;
- while (@{ $atom_interaction[$y] }) {
- if ($atom_interaction[$x][$y] < $min{'eng'} && $x != $y) {
- $min{'eng'}=$atom_interaction[$x][$y];
- $min{'x'}=$x;
- $min{'y'}=$y;
- }
- if ($atom_interaction[$x][$y] > $max{'eng'} && $x != $y) {
- $max{'eng'}=$atom_interaction[$x][$y];
- $max{'x'}=$x;
- $max{'y'}=$y;
- }
- $y++;
- }
- $x++;
- }
- print "min saveika tarp atomu $min{'x'} ir $min{'y'} energija: $min{'eng'}\n";
- print "max saveika tarp atomu $max{'x'} ir $max{'y'} energija: $max{'eng'}\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement