root / ase / io / cmdft.py @ 15
Historique | Voir | Annoter | Télécharger (653 octet)
1 |
from math import pi, cos, sin, sqrt, acos |
---|---|
2 |
import numpy as np |
3 |
|
4 |
from ase.atom import Atom |
5 |
from ase.atoms import Atoms |
6 |
from ase.parallel import paropen |
7 |
from ase.units import Bohr |
8 |
|
9 |
|
10 |
def read_I_info(fileobj, index=-1): |
11 |
if isinstance(fileobj, str): |
12 |
fileobj = open(fileobj)
|
13 |
|
14 |
lines = fileobj.readlines() |
15 |
|
16 |
del lines[0] |
17 |
|
18 |
finished = False
|
19 |
s = Atoms() |
20 |
while not finished: |
21 |
w = lines.pop(0).split()
|
22 |
if w[0].startswith('"'): |
23 |
position = Bohr * np.array([float(w[3]), float(w[4]), float(w[5])]) |
24 |
s.append(Atom(w[0].replace('"',''), position)) |
25 |
else:
|
26 |
finished = True
|
27 |
|
28 |
return s
|