Skip to main content
edited tags
Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
Became Hot Network Question
Source Link
我心永恒
  • 1.6k
  • 7
  • 10

Extract coordinates from the Gaussian09 calculation file

text = " Deg. of freedom     1
 Full point group                 T       NOp  12
 Largest Abelian subgroup         D2      NOp   4
 Largest concise Abelian subgroup D2      NOp   4
                         Standard orientation:                         
 ---------------------------------------------------------------------\

 Center     Atomic      Atomic             Coordinates (Angstroms)
 Number     Number       Type             X           Y           Z
 ---------------------------------------------------------------------\

      1          6           0        0.000000    0.000000    0.\
000000
      2          1           0        0.617765    0.617765    0.\
617765
      3          1           0       -0.617765   \
-0.617765    0.617765
      4          1           0       -0.617765    0.617765   \
-0.617765
      5          1           0        0.617765   -0.617765   \
-0.617765
 ---------------------------------------------------------------------\

 Rotational constants (GHZ):    \
164.2463791    164.2463791    164.2463791
 Standard basis: 6-31G(d) (6D, 7F)
 There are     8 symmetry adapted cartesian basis functions of \
A   symmetry.
 There are     5 symmetry adapted cartesian basis functions of B1  \
symmetry.
 Old FWG=T    [O(C1),4C3(H1)]
 New FWG=TD   [O(C1),4C3(H1)]
 Largest Abelian subgroup         D2      NOp   4
 Largest concise Abelian subgroup D2      NOp   4
                         Standard orientation:                         
 ---------------------------------------------------------------------\

 Center     Atomic      Atomic             Coordinates (Angstroms)
 Number     Number       Type             X           Y           Z
 ---------------------------------------------------------------------\

      1          6           0        0.000000    0.000000    0.\
000000
      2          1           0        0.631339    0.631339    0.\
631339
      3          1           0       -0.631339   \
-0.631339    0.631339
      4          1           0       -0.631339    0.631339   \
-0.631339
      5          1           0        0.631339   -0.631339   \
-0.631339
 ---------------------------------------------------------------------\

 Rotational constants (GHZ):    \
157.2594345    157.2594345    157.2594345";

Here's a text,It is actually generated by the Gaussian09 calculation program. I have captured a small part here, and my goal is to extract the coordinates inside, as shown in the figure below

enter image description here

My idea is to take most of this out and look at it with "Standard orientation:" and "--"

enter image description here

str1 = "Standard orientation:";
str2 = "---------------------------------------------------------------------";

I tried to use the StringCases function to do it but I've done it many times and failed, and now I don't know how to do it, I don't know what match to do to match what I want, I can't think of so far