Skip to content

Commit 945b6ee

Browse files
committed
Updated atom table to support saving labels (if present)
1 parent 520464a commit 945b6ee

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

exatomic/algorithms/diffusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ def einstein_relation(universe, length='cm', time='s'):
3434
msd = absolute_squared_displacement(universe).mean(axis=1)
3535
t = universe.frame['time'].values
3636
msd *= Length['au', length]**2
37-
t /= Time['ps', time]
37+
t /= Time['au', time]
3838
return msd / (6 * t)

exatomic/atom.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from traitlets import Dict, Unicode
1313
from exa.numerical import DataFrame, SparseDataFrame, Series
1414
from exa.relational.isotope import (symbol_to_color, symbol_to_radius,
15-
symbol_to_element_mass)
15+
symbol_to_element_mass)
1616
from exatomic.error import PeriodicUniverseError
1717
from exatomic.algorithms.distance import minimal_image_counts
1818
from exatomic.algorithms.geometry import make_small_molecule
@@ -51,7 +51,8 @@ class Atom(DataFrame):
5151
_precision = {'x': 2, 'y': 2, 'z': 2}
5252
_index = 'atom'
5353
_cardinal = ('frame', np.int64)
54-
_categories = {'symbol': str, 'set': np.int64, 'molecule': np.int64}
54+
_categories = {'symbol': str, 'set': np.int64, 'molecule': np.int64,
55+
'label': np.int64}
5556
_traits = ['x', 'y', 'z', 'set']
5657
_columns = ['x', 'y', 'z', 'symbol']
5758

exatomic/container.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def compute_atom_two(self, mapper=None, bond_extra=0.45):
113113
self.projected_atom = projected_atom
114114
else:
115115
self.atom_two = compute_atom_two(self, mapper, bond_extra)
116+
self._traits_need_update = True
116117

117118
def compute_bonds(self, mapper=None, bond_extra=0.45):
118119
"""
@@ -123,6 +124,7 @@ def compute_bonds(self, mapper=None, bond_extra=0.45):
123124
"""
124125
self.atom_two.compute_bonds(self.atom['symbol'], mapper=mapper, bond_extra=bond_extra)
125126
self.compute_molecule()
127+
self._traits_need_update = True
126128

127129
def compute_bond_count(self):
128130
"""
@@ -175,6 +177,7 @@ def add_field(self, field):
175177
self.field = AtomicField(new_field, field_values=new_field_values)
176178
else:
177179
raise TypeError('field must be an instance of exatomic.field.AtomicField or a list of them')
180+
self._traits_need_update = True
178181

179182
def add_molecular_orbitals(self, *field_params, mocoefs=None, vector=None):
180183
"""
@@ -190,6 +193,7 @@ def add_molecular_orbitals(self, *field_params, mocoefs=None, vector=None):
190193
if not hasattr(self, '_basis_set_order'):
191194
print('Warning: without the basis_set_order, MOs are likely incorrect.')
192195
_add_mos_to_universe(self, *field_params, mocoefs=mocoefs, vector=vector)
196+
self._traits_need_update = True
193197

194198
def update_molecular_orbitals(self, *field_params, mocoefs=None, vector=None):
195199
"""
@@ -203,6 +207,7 @@ def update_molecular_orbitals(self, *field_params, mocoefs=None, vector=None):
203207
if not hasattr(self, 'basis_functions'):
204208
raise AttributeError('Universe has no basis functions, add_molecular_orbitals first')
205209
_update_mos(self, *field_params, mocoefs=mocoefs, vector=vector)
210+
self._traits_need_update = True
206211

207212
def _custom_traits(self):
208213
"""

0 commit comments

Comments
 (0)