| 1 | # | 
|---|
| 2 | #    MoleCuilder - creates and alters molecular systems | 
|---|
| 3 | #    Copyright (C) 2019 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 | # | 
|---|
| 19 | # pyMoleCuilder | 
|---|
| 20 |  | 
|---|
| 21 | AT_SETUP([Python scripts - getter and setter for x,v,f]) | 
|---|
| 22 | AT_KEYWORDS([python getter setter]) | 
|---|
| 23 | AT_DATA([pythontest.py], [[ | 
|---|
| 24 | import pyMoleCuilder as mol | 
|---|
| 25 | import numpy as np | 
|---|
| 26 | mol.AtomAdd("H", "0.,0.,0.") | 
|---|
| 27 | mol.SelectionAllAtoms() | 
|---|
| 28 | mol.wait() | 
|---|
| 29 | print(mol.get_positions()) | 
|---|
| 30 | a=np.zeros((1,3)) | 
|---|
| 31 | a[0,0]=1. | 
|---|
| 32 | mol.set_positions(a) | 
|---|
| 33 | a[0,1]=1. | 
|---|
| 34 | mol.set_velocities(a) | 
|---|
| 35 | a[0,2]=1. | 
|---|
| 36 | mol.set_forces(a) | 
|---|
| 37 | print(mol.get_positions()) | 
|---|
| 38 | print(mol.get_velocities()) | 
|---|
| 39 | print(mol.get_forces()) | 
|---|
| 40 | ]]) | 
|---|
| 41 | AT_CHECK([../../run pythontest.py], 0, [stdout], [ignore]) | 
|---|
| 42 | AT_CHECK([fgrep "[[ 1.  1.  1.]]" stdout], 0, [ignore], [ignore]) | 
|---|
| 43 | AT_CLEANUP | 
|---|