Skip to content

Commit

Permalink
Remove the wrap option from to_system
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan committed Nov 2, 2023
1 parent 21cc63b commit d751ef1
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions electronicparsers/crystal/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def to_k_points(segments):
return all_k_points


def to_system(atomic_numbers, labels, positions, lattice, dimensionality, wrap=False):
def to_system(atomic_numbers, labels, positions, lattice, dimensionality):
"""Converts a Crystal-specific structure format into cartesian positions
and lattice vectors (if present). The conversion depends on the material
type.
Expand All @@ -1008,33 +1008,21 @@ def to_system(atomic_numbers, labels, positions, lattice, dimensionality, wrap=F

# Convert positions based on the given type
if dimensionality == 0:
if lattice_vectors is not None and wrap:
cart_pos = atomutils.wrap_positions(positions, lattice_vectors)
else:
cart_pos = positions
cart_pos = positions
elif dimensionality == 2:
n_atoms = atomic_numbers.shape[0]
scaled_pos = np.zeros((n_atoms, 3), dtype=np.float64)
scaled_pos[:, 0:2] = positions[:, 0:2]
if wrap:
wrapped_pos = atomutils.wrap_positions(scaled_pos)
else:
wrapped_pos = scaled_pos
cart_pos = atomutils.to_cartesian(wrapped_pos, lattice_vectors)
cart_pos = atomutils.to_cartesian(scaled_pos, lattice_vectors)
cart_pos[:, 2:3] = positions[:, 2:3]
elif dimensionality == 1:
n_atoms = atomic_numbers.shape[0]
scaled_pos = np.zeros((n_atoms, 3), dtype=np.float64)
scaled_pos[:, 0:1] = positions[:, 0:1]
if wrap:
wrapped_pos = atomutils.wrap_positions(scaled_pos)
else:
wrapped_pos = scaled_pos
cart_pos = atomutils.to_cartesian(wrapped_pos, lattice_vectors)
cart_pos = atomutils.to_cartesian(scaled_pos, lattice_vectors)
cart_pos[:, 1:3] = positions[:, 1:3]
elif dimensionality == 3:
scaled_pos = atomutils.wrap_positions(positions) if wrap else positions
cart_pos = atomutils.to_cartesian(scaled_pos, lattice_vectors)
cart_pos = atomutils.to_cartesian(positions, lattice_vectors)

if lattice_vectors is not None:
lattice_vectors *= ureg.angstrom
Expand Down

0 comments on commit d751ef1

Please sign in to comment.