1
1
"""Contains the classes which deal with the atoms.
2
2
3
- Copyright (C) 2013, Joshua More and Michele Ceriotti
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
3
Used for holding information about the atoms, including their positions, masses
20
4
momenta and kinetic energy. Has separate classes for accessing the global
21
5
arrays of atoms and for individual atoms.
@@ -37,33 +21,33 @@ class Atom(dobject):
37
21
This is actually only an interface to the Atoms class, i.e. only stores
38
22
views of the large arrays which contain all the coordinates.
39
23
40
- Attributes:
41
- kin: The kinetic energy of the atom.
42
- kstress: The contribution of the atom to the kinetic stress tensor.
24
+ **Depend objects**
43
25
44
- Depend objects:
45
- p: The three components of the momentum of the atom.
46
- q: The three components of the position of the atom.
47
- m: The mass of the atom.
48
- name: The name of the atom.
49
- m3: An array of 3 elements with each element being the mass of the atom.
50
- Used when each degree of freedom needs to be divided by the mass.
26
+ :p: The three components of the momentum of the atom.
27
+ :q: The three components of the position of the atom.
28
+ :m: The mass of the atom.
29
+ :name: The name of the atom.
30
+ :m3: An array of 3 elements with each element being the mass of the atom.
31
+ Used when each degree of freedom needs to be divided by the mass.
51
32
"""
52
33
53
34
def __init__ (self , system , index ):
54
35
"""Initialises Atom.
55
36
56
- Args:
57
- system: An Atoms object containing the required atom.
58
- index: An integer giving the index of the required atom in the atoms
59
- list. Note that indices start from 0.
37
+ Arguments
38
+
39
+ `system`
40
+ An Atoms object containing the required atom.
41
+ `index`
42
+ An integer giving the index of the required atom in the atoms
43
+ list. Note that indices start from 0.
60
44
"""
61
45
62
- dset (self ,"p" ,system .p [3 * index :3 * index + 3 ])
63
- dset (self ,"q" ,system .q [3 * index :3 * index + 3 ])
64
- dset (self ,"m" ,system .m [index :index + 1 ])
65
- dset (self ,"name" ,system .names [index :index + 1 ])
66
- dset (self ,"m3" ,system .m3 [3 * index :3 * index + 3 ])
46
+ dset (self , "p" , system .p [3 * index :3 * index + 3 ])
47
+ dset (self , "q" , system .q [3 * index :3 * index + 3 ])
48
+ dset (self , "m" , system .m [index :index + 1 ])
49
+ dset (self , "name" , system .names [index :index + 1 ])
50
+ dset (self , "m3" , system .m3 [3 * index :3 * index + 3 ])
67
51
68
52
@property
69
53
def kin (self ):
@@ -92,26 +76,28 @@ class Atoms(dobject):
92
76
and a convenience-access is provided through a list of Atom objects.
93
77
94
78
Attributes:
95
- natoms: The number of atoms.
79
+
80
+ * **natoms** The number of atoms.
96
81
97
82
Depend objects:
98
- p: An array giving the components of the atom positions.
99
- q: An array giving the components of the atom momenta.
100
- m: An array giving the atom masses.
101
- names: An array giving the atom names.
102
- m3: An array of 3*n elements where each element of m has been copied
103
- three times. Used when each degree of freedom needs to be divided
104
- by the mass.
105
- M: The total mass of all the atoms.
106
- kin: The total kinetic energy of the atoms. Depends on p and m3.
107
- kstress: The contribution of the atoms to the kinetic stress tensor.
108
- Depends on px, py, pz and m.
109
- qx: An array giving the x components of the positions.
110
- qy: An array giving the y components of the positions.
111
- qz: An array giving the z components of the positions.
112
- px: An array giving the x components of the momenta.
113
- py: An array giving the y components of the momenta.
114
- pz: An array giving the z components of the momenta.
83
+
84
+ * **p** An array giving the components of the atom positions.
85
+ * **q** An array giving the components of the atom momenta.
86
+ * **m** An array giving the atom masses.
87
+ * **names** An array giving the atom names.
88
+ * **m3** An array of 3*n elements where each element of m has been copied
89
+ three times. Used when each degree of freedom needs to be divided
90
+ by the mass.
91
+ * **M** The total mass of all the atoms.
92
+ * **kin** The total kinetic energy of the atoms. Depends on p and m3.
93
+ * **kstress** The contribution of the atoms to the kinetic stress tensor.
94
+ Depends on px, py, pz and m.
95
+ * **qx** An array giving the x components of the positions.
96
+ * **qy** An array giving the y components of the positions.
97
+ * **qz** An array giving the z components of the positions.
98
+ * **px** An array giving the x components of the momenta.
99
+ * **py** An array giving the y components of the momenta.
100
+ * **pz** An array giving the z components of the momenta.
115
101
"""
116
102
117
103
@@ -122,11 +108,12 @@ def __init__(self, natoms, _prebind=None):
122
108
and so slices of the global position and momentum arrays must be used in
123
109
the initialisation so that they always agree with each other.
124
110
125
- Args:
126
- natoms: An integer giving the number of atoms.
127
- _prebind: An optional tuple of four elements; a depend_array of length
128
- 3*natoms for the positions, another for the momenta, a depend_array
129
- of length natoms for the masses and another for the names.
111
+ Arguments:
112
+
113
+ * **natoms** An integer giving the number of atoms.
114
+ * **_prebind** An optional tuple of four elements; a depend_array of length
115
+ 3*natoms for the positions, another for the momenta, a depend_array
116
+ of length natoms for the masses and another for the names.
130
117
"""
131
118
132
119
self .natoms = natoms
0 commit comments