Skip to content

l202.distmat ​

Implementation level ​

TypeStatus
CML extraction template
HTML5 representation

Template attributes ​

AttributeValue
sourceGaussian log
idl202.distmat
nameDistance matrix
repeat*
pattern\s*Distance matrix.*$[\s\d]+
endPattern\s?[A-Z].*
xml:basel202/l202.distmat.xml

Input ​

                    Distance matrix (angstroms):
                    1          2          3          4          5
     1  Al   0.000000
     2  Al   1.534811   0.000000
     3  Al   2.965253   1.534811   0.000000
     4  Al   4.193182   2.964801   1.534811   0.000000
     5  Al   5.135969   4.193182   2.965253   1.534811   0.000000
     6  Al   5.727993   5.135187   4.193182   2.964801   1.534811
     7  Al   5.930507   5.727993   5.135969   4.193182   2.965253
     8  Al   5.727993   5.929603   5.727993   5.135187   4.193182
     9  Al   5.135969   5.727993   5.930507   5.727993   5.135969
    10  Al   4.193182   5.135187   5.727993   5.929603   5.727993
    11  Al   2.965253   4.193182   5.135969   5.727993   5.930507
    12  Al   1.534811   2.964801   4.193182   5.135187   5.727993
                    6          7          8          9         10
     6  Al   0.000000
     7  Al   1.534811   0.000000
     8  Al   2.964801   1.534811   0.000000
     9  Al   4.193182   2.965253   1.534811   0.000000
    10  Al   5.135187   4.193182   2.964801   1.534811   0.000000
    11  Al   5.727993   5.135969   4.193182   2.965253   1.534811
    12  Al   5.929603   5.727993   5.135187   4.193182   2.964801
                   11         12
    11  Al   0.000000
    12  Al   1.534811   0.000000
 Test    

Input ​

                    Distance matrix (angstroms):
                    1          2          3          4          5
     1  C    0.000000
     2  H    1.113000   0.000000
     3  H    1.113000   1.817522   0.000000
     4  H    1.113000   1.817521   1.817522   0.000000
     5  H    1.113000   1.817522   1.817522   1.817522   0.000000
 Test 

Output text ​

xml
<comment class="example.output" id="l202.distmat.1">
    <module cmlx:templateRef="l202.distmat">
      <array dataType="xsd:double" size="78" dictRef="cc:distance">0.0 1.534811 0.0 2.965253 1.534811 0.0 4.193182 2.964801 1.534811 0.0 5.135969 4.193182 2.965253 1.534811 0.0 5.727993 5.135187 4.193182 2.964801 1.534811 0.0 5.930507 5.727993 5.135969 4.193182 2.965253 1.534811 0.0 5.727993 5.929603 5.727993 5.135187 4.193182 2.964801 1.534811 0.0 5.135969 5.727993 5.930507 5.727993 5.135969 4.193182 2.965253 1.534811 0.0 4.193182 5.135187 5.727993 5.929603 5.727993 5.135187 4.193182 2.964801 1.534811 0.0 2.965253 4.193182 5.135969 5.727993 5.930507 5.727993 5.135969 4.193182 2.965253 1.534811 0.0 1.534811 2.964801 4.193182 5.135187 5.727993 5.929603 5.727993 5.135187 4.193182 2.964801 1.534811 0.0</array>
    </module>
  </comment>

Output text ​

xml
<comment class="example.output" id="l202.distmat.2">
    <module cmlx:templateRef="l202.distmat">
      <array dataType="xsd:double" size="15" dictRef="cc:distance">0.0 1.113 0.0 1.113 1.817522 0.0 1.113 1.817521 1.817522 0.0 1.113 1.817522 1.817522 1.817522 0.0</array>
    </module>
  </comment>

Template definition ​

xml
<record repeat="1" id="y">&#123;X,y:y&#125;</record>
<templateList>  <template id="l202.distance" pattern="\s&#123;10&#125;\s*\d+\s*[\d\s]*$.*" endPattern=".*$\s&#123;10&#125;\s*[\s\d]+.*" endPattern2="~" endOffset="1" repeat="*">    <record id="serial">&#123;1_5I,x:serial&#125;</record>    <record repeat="*" id="row">\s*&#123;I,g:row&#125;\s&#123;A,cc:elementType&#125;\s&#123;1_5F,cc:distance&#125;</record>          
    </template>
    
  </templateList>
<transform process="joinArrays" xpath=".//cml:array[@dictRef='x:serial']" />
<transform process="addAttribute" xpath=".//cml:array[@dictRef='cc:distance']" name="cmlx:row" value="$string(../cml:scalar[@dictRef='g:row'])" />
<transform process="joinArrays" xpath=".//cml:array[@cmlx:row]" key="$string(@cmlx:row)" />
<transform process="joinArrays" xpath=".//cml:module[@cmlx:templateRef='l202.distance'][1]//cml:list[@cmlx:templateRef='row']//cml:array" />
<transform process="delete" xpath=".//cml:scalar[@dictRef='y:y']" />
<transform process="delete" xpath=".//cml:scalar[@dictRef='g:row']" />
<transform process="delete" xpath=".//cml:scalar[@dictRef='cc:elementType']" />
<transform process="delete" xpath=".//cml:array[@dictRef='x:serial']" />
<transform process="delete" xpath="text()" />
<transform process="pullup" xpath=".//cml:array" repeat="3" />
<transform process="delete" xpath=".//cml:module[@cmlx:templateRef='l202.distance']" />
<transform process="delete" xpath=".//cml:list[count(*)=0]" />
<transform process="delete" xpath=".//cml:list[count(*)=0]" />