=== Creating Arbitrary Alkanes === [[Image(butane.png)]] This can also be used (in a somewhat unusual way) to generate alkanes of arbitrary length from a given one. Assume, we have a butane as given. We cut off the terminal hydrogens at either end and place them in files ''buildingblock_upper.xyz'' and ''buildingblock_lower.xyz''. To correct for the displacement, we subtract the position of its carbon neighbor as if it were at "0,5,5". {{{ ./molecuilder -i buildingblock_upper.xyz --select-all-atoms -t "-8.3885,-1.5127,-0.89" -s buildingblock_upper.xyz --undo }}} In the same way we proceed with the hydrogen at the other end stored in ''buildingblock_lower.xyz''. {{{ ./molecuilder -i buildingblock_lower.xyz --select-all-atoms -t "-12.1362,-1.5127,-0.89" }}} where we translate the position such that it's relative to the same carbon at "0,5,5" and additionally we have to compensate for the x distance which we set such that is bond partner would be at "x=0". Furthermore, we cut out the first pair of carbon atoms along with the four hydrogens (not the terminal one) and store it in ''buildingblock_center.xyz''. {{{ ./molecuilder -i buildingblock.xyz --select-atoms-inside-cuboid "2.5,5,5" --position "8.3,3,3" -s buildingblock_center.xyz }}} Sadly, we have to take a look here at the coordinates in the xyz file to know what to cut out. We pick a position slightly before the first carbon atom. Finally, we have to translate the section {{{ ./molecuilder -i buildingblock_center.xyz --select-all-atoms -t "-8.3885,-1.5127,-0.89" }}} such that the first carbon atom is at "0,5,5". [[Image(buildingblock_center.png)]] Then we may proceed as follows to produce a decane. {{{ ./molecuilder -i decane.xyz --change-box "2.4985,0,10,0,0,10" -l buildingblock_center.xyz --repeat-box "5,1,1" }}} where we obtained the box length from the distance of one carbon atom to its next-nearest neighbor. That is: * first, we use ''-i'' to store everything in a new file ''decane.xyz''. * Next, we set the box dimensions (''--change-box'') to fit with the periodicity of the alkanes, here in the x direction. * Then, we load (''-l'') the atoms into this domain. * Finally, we call ''--repeat-box'' the create five copies from the given segment containing two carbons. At last, we need to re-attach the terminal hydrogen atoms. First the upper part, which is easier {{{ ./molecuilder -i decane.xyz -l buildingblock_upper.xyz }}} Then the lower part which has to be translated to its destination {{{ ./molecuilder -i decane.xyz -l buildingblock_lower.xyz --select-molecule-by-order -1 --select-molecules-atoms -t "11.24325,0,0" }}} where the translation factor is 4.5 times the above periodicity in the x direction. That is: * first, we use ''-i'' to work on the file ''decane.xyz'' where the "truncated" decane is contained. * Then, we load (''-l'') the hydrogen atom into this domain, it is automatically placed into a new molecule * We select this (last) molecule (''--select-molecule-by-order'') where ''-1'' is the reverse order, 1 is first, -1 is last, -2 is second to last, ... (Note: we might as well have selected the molecule by its name buildingblock_left with ''--select-molecule-by-name''). * We transform the molecule selection into an atomic selection (''--select-molecules-atoms'') for the subsequent translation working on atoms. * Finally, we call ''-t'' to translate the selected hydrogen atom at its final position. And finally, we have a complete decane molecule. [[Image(decane.png)]] Now, one may ask: Why not do this in a text editor? Of course, the duplication along with the translation of the periodic section is nice. Moreover however this approach can easily be placed in a script file and arbitrary alkanes can be produced by calling this script. ,,This has been done with version v1.1.3,,