From: toshinagata1964 Date: Fri, 25 Jul 2014 07:34:05 +0000 (+0000) Subject: DRC log from GAMESS can be imported now X-Git-Tag: v1.0.2~81 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=67f8fad34a70e3c4df06d118bfbbc84859d166d8;p=molby%2FMolby.git DRC log from GAMESS can be imported now git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@560 a2be9bc6-48de-4e38-9406-05402d4bc13c --- diff --git a/Scripts/gamess.rb b/Scripts/gamess.rb index b989a07..e875fc5 100755 --- a/Scripts/gamess.rb +++ b/Scripts/gamess.rb @@ -420,6 +420,7 @@ class Molecule lineno = 0 last_line = "" search_mode = 0 + nserch = -1 rflag = 0 ne_alpha = ne_beta = 0 mo_count = 0 @@ -483,7 +484,6 @@ class Molecule size = fplog.tell last_i = nil i = 0 - nserch = -1 while i < lines.count line = lines[i] if line =~ /GEOMETRY SEARCH POINT NSERCH= *(\d+)/ @@ -491,6 +491,10 @@ class Molecule last_i = i search_mode = 1 energy = nil + elsif line =~ /START OF DRC CALCULATION/ + search_mode = 3 + nserch = 1 + energy = nil elsif line =~ /CONSTRAINED OPTIMIZATION POINT/ search_mode = 2 energy = nil @@ -600,11 +604,15 @@ class Molecule elsif nserch > 0 && line =~ /ddikick\.x/ last_i = -1 break - elsif mol && nserch > 0 && line =~ /COORDINATES OF ALL ATOMS/ - # There should be (natoms + 2) lines - if i + mol.natoms + 3 <= lines.count + elsif mol && nserch > 0 && (line =~ /COORDINATES OF ALL ATOMS/ || line =~ /COORDINATES \(IN ANGSTROM\) FOR \$DATA GROUP ARE/) + # There should be (natoms) lines + if line =~ /COORDINATES OF ALL ATOMS/ + # Skip header lines + i += 2 + end + if i + mol.natoms + 1 <= lines.count coords = [] - (i + 3...i + 3 + mol.natoms).each { |j| + (i + 1...i + 1 + mol.natoms).each { |j| name, charge, x, y, z = lines[j].split coords.push(Vector3D[x.to_f, y.to_f, z.to_f]) } @@ -613,7 +621,7 @@ class Molecule mol.set_property("energy", energy) end mol.display - last_i = i + mol.natoms + 2 + last_i = i + mol.natoms i = last_i # Skip the processed lines end end diff --git a/Scripts/loadsave.rb b/Scripts/loadsave.rb index 06c7632..44c6e78 100755 --- a/Scripts/loadsave.rb +++ b/Scripts/loadsave.rb @@ -264,23 +264,26 @@ class Molecule break end line.chomp! - if line =~ /ATOM\s+ATOMIC\s+COORDINATES/ || line =~ /COORDINATES OF ALL ATOMS ARE/ + if line =~ /ATOM\s+ATOMIC\s+COORDINATES/ || line =~ /COORDINATES OF ALL ATOMS ARE/ || line =~ /COORDINATES \(IN ANGSTROM\) FOR \$DATA GROUP ARE/ set_progress_message(mes + "\nReading atomic coordinates...") if line =~ /ATOMIC/ first_line = true if !new_unit next # Skip initial atomic coordinates unless loading into an empty molecule end + line = fp.gets # Skip one line else first_line = false nsearch += 1 + if line =~ /COORDINATES OF ALL ATOMS ARE/ + line = fp.gets # Skip one line + end end - line = fp.gets # Skip one line n = 0 coords = [] names = [] while (line = fp.gets) != nil - break if line =~ /^\s*$/ || line =~ /END OF ONE/ + break if line =~ /^\s*$/ || line =~ /END OF ONE/ || line =~ /\$END/ next if line =~ /-----/ name, charge, x, y, z = line.split v = Vector3D[x, y, z]