Commit 66fc581c authored by ggandus's avatar ggandus
Browse files

add file python_exemples

parent 362c0b7e
%% Cell type:code id: tags:
``` python
from ase import Atoms
from ase.visualize import view
from ase.io import read
import numpy as np
```
%% Cell type:code id: tags:
``` python
molecule = read('dummy_molecule.xyz')
view(molecule)
molecule[0]
```
%% Output
Atom('N', [0.0, 0.0, 1.0], index=0)
%% Cell type:code id: tags:
``` python
molecule.get_positions()
```
%% Output
array([[0., 0., 1.],
[0., 1., 0.],
[1., 0., 0.]])
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
for atom in molecule:
print(atom.index)
```
%% Output
0
1
2
%% Cell type:code id: tags:
``` python
distance = np.zeros([len(molecule.get_positions()),len(molecule.get_positions())])
for atom in molecule:
for atom2 in molecule:
if atom2.index>atom.index:
distance[atom.index][atom2.index]=molecule.get_distance(atom.index,atom2.index)
distance
```
%% Output
array([[0. , 1.41421356, 1.41421356],
[0. , 0. , 1.41421356],
[0. , 0. , 0. ]])
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```