Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ladinesa committed Apr 25, 2024
1 parent 7ff8e6f commit d8360f0
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 54 deletions.
18 changes: 10 additions & 8 deletions atomisticparsers/dlpoly/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def to_bonds(val_in):
dict(
functional_form=potentials.get(val_n[0], val_n[0]),
# atom index starts from 1
atom_indices=[int(n) - 1 for n in val_n[1:3]],
atom_indices=[[int(n) - 1 for n in val_n[1:3]]],
parameters=[float(v) for v in val_n[3:]],
)
)
Expand All @@ -180,7 +180,7 @@ def to_angles(val_in):
interactions.append(
dict(
functional_form=potentials.get(val_n[0], val_n[0]),
atom_indices=[int(n) - 1 for n in val_n[1:4]],
atom_indices=[[int(n) - 1 for n in val_n[1:4]]],
parameters=[float(v) for v in val_n[4:]],
)
)
Expand All @@ -202,7 +202,7 @@ def to_dihedrals(val_in):
interactions.append(
dict(
functional_form=potentials.get(val_n[0], val_n[0]),
atom_indices=[int(n) - 1 for n in val_n[1:5]],
atom_indices=[[int(n) - 1 for n in val_n[1:5]]],
parameters=[float(v) for v in val_n[5:]],
)
)
Expand All @@ -221,7 +221,7 @@ def to_inversions(val_in):
interactions.append(
dict(
functional_form=potentials.get(val_n[0], val_n[0]),
atom_indices=[int(n) - 1 for n in val_n[1:5]],
atom_indices=[[int(n) - 1 for n in val_n[1:5]]],
parameters=[float(v) for v in val_n[5:]],
)
)
Expand All @@ -235,7 +235,7 @@ def to_teth(val_in):
interactions.append(
dict(
functional_form=potentials.get(val_n[0], val_n[0]),
atom_indices=[int(n) - 1 for n in val_n[1:2]],
atom_indices=[[int(n) - 1 for n in val_n[1:2]]],
parameters=[float(v) for v in val_n[2:]],
)
)
Expand Down Expand Up @@ -377,7 +377,7 @@ def to_metal(val_in):
convert=False,
str_operation=lambda x: [
dict(
atom_indices=[int(v) - 1 for v in val[:2]],
atom_indices=[[int(v) - 1 for v in val[:2]]],
parameters=[float(v) for v in val[2:3]],
)
for val in [v.split() for v in x.strip().splitlines()]
Expand Down Expand Up @@ -649,14 +649,16 @@ def get_system_data(frame_index):
sec_interaction = Interaction()
sec_model.contributions.append(sec_interaction)
for key, val in interaction.items():
setattr(sec_interaction, key, val)
sec_interaction.m_set(
sec_interaction.m_get_quantity_definition(key), val
)
# add constraints to initial system
constraint_data = []
for constraint in molecule.get("constraints", []):
constraint_data.append(
dict(
kind="fixed bond length",
atom_indices=[constraint.get("atom_indices")],
atom_indices=constraint.get("atom_indices"),
parameters=constraint.get("parameters"),
)
)
Expand Down
Loading

0 comments on commit d8360f0

Please sign in to comment.