Skip to content

xtb.geometry ​

Implementation level ​

TypeStatus
CML extraction template
HTML5 representation

Template attributes ​

AttributeValue
sourcexTB geometry
idxtb.geometry
namexTB geometry
xml:basetopTemplate.xml

Input

3

O         -4.13991       -0.61614        0.00000
H         -3.16991       -0.61614        0.00000
H         -4.46324       -0.01169        0.68629

Input

$coord
   -1.79267785959847      1.79292955735194      0.21711880587130      c
   -4.64203009819663      1.72468295013673      0.02453055135240      c
   -0.72232010533118     -0.24797200680902     -0.93360778001220      o
   -0.54455624070009      3.43404491170542      1.23097558734935      o
   -5.21620927420535      1.96641450686901     -1.97654604682259      h
   -5.37835337636643     -0.13077600720316      0.65353691515396      h
   -5.45824155751658      3.26101743354623      1.17396390907241      h
    1.10943076339537     -0.01816375217267     -0.73154500494978      h
$end    

Output text

xml
<comment class="example.output" id="xtb.geometry">
        <module cmlx:templateRef="coords">
            <molecule id="initial">
                <atomArray>
                    <atom elementType="O" id="a1" x3="-4.13991" y3="-0.61614" z3="0.0000" />
                    <atom elementType="H" id="a2" x3="-3.16991" y3="-0.61614" z3="0.0000" />
                    <atom elementType="H" id="a3" x3="-4.46324" y3="-0.01169" z3="0.68629" />
                </atomArray>
                <bondArray>
                    <bond atomRefs2="a1 a2" order="S" />
                    <bond atomRefs2="a1 a3" order="S" />
                </bondArray>
                <formula concise="H2O">
                    <atomArray count="2 1" elementType="H O" />
                </formula>
                <property dictRef="cml:molmass">
                    <scalar units="unit:dalton">15.9994</scalar>
                </property>
            </molecule>
        </module>
    </comment>

Output text

xml
<comment class="example.output" id="xtb.geometry2">
       <module cmlx:templateRef="coords">
            <molecule id="initial">
                <atomArray>
                    <atom elementType="C" id="a1" x3="-0.94864389" y3="0.94877708" z3="0.11489428" />
                    <atom elementType="C" id="a2" x3="-2.45645556" y3="0.91266255" z3="0.012981" />
                    <atom elementType="O" id="a3" x3="-0.38223519" y3="-0.13122108" z3="-0.49404376" />
                    <atom elementType="O" id="a4" x3="-0.28816664" y3="1.81721758" z3="0.65140397" />
                    <atom elementType="H" id="a5" x3="-2.76029798" y3="1.04058133" z3="-1.04594271" />
                    <atom elementType="H" id="a6" x3="-2.8461009" y3="-0.06920366" z3="0.3458367" />
                    <atom elementType="H" id="a7" x3="-2.88837589" y3="1.72565542" z3="0.6212347" />
                    <atom elementType="H" id="a8" x3="0.58708524" y3="-0.00961184" z3="-0.38711679" />
                </atomArray>
                <bondArray>
                    <bond atomRefs2="a1 a4" order="S" />
                    <bond atomRefs2="a1 a3" order="S" />
                    <bond atomRefs2="a1 a2" order="S" />
                    <bond atomRefs2="a2 a5" order="S" />
                    <bond atomRefs2="a2 a6" order="S" />
                    <bond atomRefs2="a2 a7" order="S" />
                    <bond atomRefs2="a3 a8" order="S" />
                </bondArray>
                <formula concise="C2H4O2">
                    <atomArray count="2 4 2" elementType="C H O" />
                </formula>
                <property dictRef="cml:molmass">
                    <scalar units="unit:dalton">56.0202</scalar>
                </property>
            </molecule>
        </module>
    </comment>

Template definition

xml
<templateList>  <template id="coords" pattern="\s*[0-9]+\s*" endPattern="\s*\S+\s+\S+\s+\S+\s+\S+\s*$\s*" endPattern2="~" endOffset="1">    <record repeat="2" />    <record id="atom" repeat="*" makeArray="true">&#123;A,cc:elementType&#125;&#123;F,cc:x3&#125;&#123;F,cc:y3&#125;&#123;F,cc:z3&#125;</record>    <transform process="createMolecule" id="initial" xpath=".//cml:list[@cmlx:templateRef='atom']/cml:array" />
        </template>  <template id="coords" pattern="\s*\u0024coord.*" endPattern="\s*\u0024.*" endPattern2="~">    <record repeat="1" />    <record id="atom" repeat="*">&#123;F,cc:x3&#125;&#123;F,cc:y3&#125;&#123;F,cc:z3&#125;&#123;A,cc:elementType&#125;</record>    <transform process="operateScalar" xpath=".//cml:scalar[@dictRef='cc:x3']" args="operator=multiply operand=0.529177" />    <transform process="operateScalar" xpath=".//cml:scalar[@dictRef='cc:y3']" args="operator=multiply operand=0.529177" />    <transform process="operateScalar" xpath=".//cml:scalar[@dictRef='cc:z3']" args="operator=multiply operand=0.529177" />    <transform process="createArray" xpath="." from=".//cml:scalar[@dictRef='cc:x3']" />    <transform process="createArray" xpath="." from=".//cml:scalar[@dictRef='cc:y3']" />    <transform process="createArray" xpath="." from=".//cml:scalar[@dictRef='cc:z3']" />    <transform process="createArray" xpath="." from=".//cml:scalar[@dictRef='cc:elementType']" />    <transform process="pullup" xpath=".//cml:array" />    <transform process="createMolecule" xpath=".//cml:list[@cmlx:templateRef='atom']/cml:array" id="initial" />
        </template>
    </templateList>
<transform process="delete" xpath=".//cml:molecule/cml:atomArray/cml:atom/cml:scalar" />
<transform process="pullup" xpath=".//cml:molecule" />
<transform process="delete" xpath=".//cml:list[count(*)=0]" />
<transform process="delete" xpath=".//cml:list[count(*)=0]" />
<transform process="delete" xpath=".//cml:molecule[count(*)=0]" />