OSDN Git Service

On importing Gamess log file, 'energy' property values are sometimes set incorrectly...
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Tue, 26 Aug 2014 11:40:08 +0000 (11:40 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Tue, 26 Aug 2014 11:40:08 +0000 (11:40 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@564 a2be9bc6-48de-4e38-9406-05402d4bc13c

Scripts/loadsave.rb

index 7167ae0..afa2215 100755 (executable)
@@ -268,9 +268,9 @@ class Molecule
                                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
+                               #  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
@@ -311,8 +311,21 @@ class Molecule
                                        new_unit = false
                                #       create_frame
                                else
-                                       if search_mode != 1 || nsearch > 1
-                                               #  The first frame for geometry search has the same coordinates as input
+                                   dont_create = false
+                                       if (search_mode == 1 && nsearch == 1) || first_line
+                                               #  The input coordinate and the first frame for geometry search
+                                               #  can have the same coordinate as the last frame; if this is the case, then
+                                               #  do not create the new frame
+                                               select_frame(nframes - 1)
+                                               dont_create = true
+                                               each_atom { |ap|
+                                                 if (ap.r - coords[ap.index]).length2 > 1e-8
+                                                   dont_create = false
+                                                       break
+                                                 end
+                                               }
+                                       end
+                                       if !dont_create
                                                create_frame([coords])  #  Should not be (coords)
                                        end
                                end