Skip to content
Snippets Groups Projects
Commit 8082195a authored by Artem Pulkin's avatar Artem Pulkin
Browse files

dyn: cell dynamics with vectors

parent 448254a0
No related branches found
No related tags found
No related merge requests found
......@@ -103,7 +103,7 @@ class DynCell(Cell):
@property
def cell_velocity(self):
return self.meta.get("cell_velocity", None)
return self.meta.get("cell-velocity", None)
@property
def masses(self):
......@@ -124,7 +124,7 @@ class DynCell(Cell):
def copy(self, cartesian_velocity=None, cell_velocity=None, masses=None, time=None, **kwargs):
result = super().copy(**kwargs)
d = locals()
for i, j in (("cartesian_velocity", "velocities"), ("cell_velocity",) * 2, ("masses",) * 2, ("time",) * 2):
for i, j in (("cartesian_velocity", "velocities"), ("cell_velocity", "cell-velocity"), ("masses",) * 2, ("time",) * 2):
if d[i] is not None:
result.meta[j] = d[i]
return result
......@@ -249,8 +249,7 @@ class DynWrapper:
ndims = self.state.vectors.shape[0]
mass = np.repeat(self.state.masses[:, None], ndims, 1).reshape(-1)
gc = self.state.gc
gc = np.concatenate([gc.coordinates.cartesian.reshape(-1), gc.velocities.cartesian.reshape(-1)])
gc = self.wrapper.c2p(self.state.gc)
t0 = self.state.time
result = driver(lambda _, x: eom(self.wrapper, x, mass), (0, time), gc, **kwargs)
if snapshots:
......
......@@ -816,11 +816,11 @@ class ScalarFunctionWrapper:
raise ValueError("One or more potentials do not include the 'fidelity' kernel")
self.compute_images_kwargs = {"cutoff": max(i.cutoff for i in potentials), **kwargs}
def p2c(self, parameters: np.ndarray) -> sf_parameters:
def p2c(self, parameters: np.ndarray):
"""Unpacks parameters."""
return sf_parameters.unpack(parameters.reshape(-1, 3), **self.include)
def c2p(self, coordinates: sf_parameters) -> np.ndarray:
def c2p(self, coordinates) -> np.ndarray:
"""Packs parameters."""
return coordinates.copy(**self.include).pack().reshape(-1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment