| 1 | # | 
|---|
| 2 | #    MoleCuilder - creates and alters molecular systems | 
|---|
| 3 | #    Copyright (C) 2017 Frederik Heber | 
|---|
| 4 | # | 
|---|
| 5 | #    This program is free software: you can redistribute it and/or modify | 
|---|
| 6 | #    it under the terms of the GNU General Public License as published by | 
|---|
| 7 | #    the Free Software Foundation, either version 3 of the License, or | 
|---|
| 8 | #    (at your option) any later version. | 
|---|
| 9 | # | 
|---|
| 10 | #    This program is distributed in the hope that it will be useful, | 
|---|
| 11 | #    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | #    GNU General Public License for more details. | 
|---|
| 14 | # | 
|---|
| 15 | #    You should have received a copy of the GNU General Public License | 
|---|
| 16 | #    along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 17 | # | 
|---|
| 18 | ### Blog entry about many ways to translate an atom | 
|---|
| 19 |  | 
|---|
| 20 | AT_SETUP([Examples - ways to translate an atom]) | 
|---|
| 21 | AT_KEYWORDS([blog translate-atom]) | 
|---|
| 22 |  | 
|---|
| 23 | # prepare config | 
|---|
| 24 | file=water.xyz | 
|---|
| 25 | AT_CHECK([/bin/cp ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/pre/water.xyz $file], 0, [ignore], [ignore]) | 
|---|
| 26 | AT_CHECK([chmod u+w $file], 0) | 
|---|
| 27 |  | 
|---|
| 28 | # 1. use translate-atom | 
|---|
| 29 | AT_CHECK([../../molecuilder --input water_translateatom.xyz -o xyz --load $file --select-atom-by-element O --translate-atoms --position "1,0,0"], 0, [ignore], [ignore]) | 
|---|
| 30 | AT_CHECK([diff -I".*olecuilder.*" water_translateatom.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 31 |  | 
|---|
| 32 | # 2. use translate-molecule variant a | 
|---|
| 33 | AT_CHECK([../../molecuilder --input water_translatemolecule1_stage1.xyz -o xyz --load water.xyz --select-all-molecules --translate-molecules --position "1,0,0"], 0, [ignore], [ignore]) | 
|---|
| 34 | AT_CHECK([../../molecuilder --input water_translatemolecule1.xyz -o xyz --load water_translatemolecule1_stage1.xyz --select-atom-by-element H --translate-atoms --position "-1,0,0"], 0, [ignore], [ignore]) | 
|---|
| 35 | AT_CHECK([diff -I".*olecuilder.*" water_translatemolecule1.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 36 |  | 
|---|
| 37 | # 3. use translate-molecule variant b | 
|---|
| 38 | AT_CHECK([../../molecuilder --input water_translatemolecule2.xyz -o xyz --load water.xyz --update-molecules --select-molecules-by-formula O --translate-molecules --position "1,0,0" | 
|---|
| 39 | ], 0, [ignore], [ignore]) | 
|---|
| 40 | AT_CHECK([diff -I".*olecuilder.*" water_translatemolecule2.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 41 |  | 
|---|
| 42 | # 4. use random-perturbation | 
|---|
| 43 | AT_CHECK([../../molecuilder --input water_randomperturbation.xyz -o xyz --load water.xyz --set-random-number-distribution "uniform_int" --random-number-distribution-parameters "min=0;max=2;" --set-random-number-engine "mt19937" --random-number-engine-parameters "seed=120;" --select-atom-by-element O --random-perturbation 1.], 0, [ignore], [ignore]) | 
|---|
| 44 | AT_CHECK([diff -I".*olecuilder.*" water_randomperturbation.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 45 |  | 
|---|
| 46 | # 5. use stretch-bond and change-bond-angle (twice, old 0.910914 A, old angle 104.449 def) | 
|---|
| 47 | # we need to use tremolo format as pdb does not have enough output precision | 
|---|
| 48 | AT_CHECK([../../molecuilder --input water_stretchbond_stage1.data -o tremolo --set-tremolo-atomdata "Id type x=3 neighbors=4" --load water.xyz -I --select-atom-by-id 2 0 --stretch-bond 0.624310820025], 0, [ignore], [ignore]) | 
|---|
| 49 | AT_CHECK([../../molecuilder --input water_stretchbond.pdb -o pdb --load water_stretchbond_stage1.data --select-atom-by-id 2 1 --stretch-bond 1.80824887668 --select-all-atoms --change-bond-angle 45.3788358886 --select-all-molecules --rotate-around-self 70.008595817 --axis "0,1,0" --add-empty-boundary "4.28,5,4.628"], 0, [ignore], [ignore]) | 
|---|
| 50 | # we need to strip down to three digits of output precision, hence extra pdb to xyz step | 
|---|
| 51 | AT_CHECK([../../molecuilder --input water_stretchbond.pdb -o xyz], 0, [ignore], [ignore]) | 
|---|
| 52 | AT_CHECK([diff -I".*olecuilder.*" water_stretchbond.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 53 |  | 
|---|
| 54 | # 6. use fill-volume | 
|---|
| 55 | AT_CHECK([../../molecuilder --input water_fillvolume.xyz -o xyz --load water.xyz --create-shape --shape-name cyl --shape-type cylinder --stretch "1,1,1" --translation "5.28,6,5.628" --select-shape-by-name cyl --select-all-molecules -v 3 --fill-volume --count 12 --clear-molecule-selection --select-molecule-by-order 1 2 3 --remove-molecule --select-atom-by-element H --translate-atoms --position "-1,0,0"], 0, [ignore], [ignore]) | 
|---|
| 56 | AT_CHECK([diff -I".*olecuilder.*" water_fillvolume.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 57 |  | 
|---|
| 58 | # 7. use fill-surface | 
|---|
| 59 | AT_CHECK([../../molecuilder --input water_fillsurface.xyz -o xyz --load water.xyz --create-shape --shape-name ball --shape-type sphere --stretch "1,1,1" --translation "6,6,5" --select-shape-by-name ball --select-all-molecules --fill-surface --Alignment-Axis "0,1,0" --count 1 --select-atom-by-element H --translate-atoms --position "-1,0,0"], 0, [ignore], [ignore]) | 
|---|
| 60 | AT_CHECK([diff -I".*olecuilder.*" water_fillsurface.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 61 |  | 
|---|
| 62 | # 8. use remove-atom and add-atom | 
|---|
| 63 | AT_CHECK([../../molecuilder --input water_removeaddatom.xyz -o xyz --load water.xyz --select-atom-by-element O --remove-atom --add-atom O --domain-position "6,5,4.628"], 0, [ignore], [ignore]) | 
|---|
| 64 | AT_CHECK([diff -I".*olecuilder.*" water_removeaddatom.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 65 |  | 
|---|
| 66 | # 9. use mirror-atoms | 
|---|
| 67 | AT_CHECK([../../molecuilder --input water_mirroratoms.xyz -o xyz --load water.xyz --select-atom-by-element O --mirror-atoms "1,0,0" --plane-offset 5.5], 0, [ignore], [ignore]) | 
|---|
| 68 | AT_CHECK([diff -I".*olecuilder.*" water_mirroratoms.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 69 |  | 
|---|
| 70 | # 10. use scale-box | 
|---|
| 71 | AT_CHECK([../../molecuilder --input water_scalebox.xyz -o xyz --load water.xyz --change-box "10,0,10,0,0,10" --scale-box "1.2,1,1" --select-atom-by-id 0 --translate-atoms --position "-1.144,0,0" --invert-atoms --unselect-atom-by-element O --mirror-atoms "1,0,0" --plane-offset 4.708], 0, [ignore], [ignore]) | 
|---|
| 72 | AT_CHECK([diff -I".*olecuilder.*" water_scalebox.xyz ${abs_top_srcdir}/tests/Examples/ManyWaysTranslateAtom/post/water_translated.xyz], 0) | 
|---|
| 73 |  | 
|---|
| 74 | AT_CLEANUP | 
|---|