Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug name_to_index dict #134

Merged
merged 5 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/releasehistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 <https:/
Bugfixes
""""""""
- `PR #129 <https://github.com/martimunicoy/peleffy/pull/129>`_: Some format errors in the API documentation are fixed. Links to the PELE documentation are updated.
- `PR #134 <https://github.com/martimunicoy/peleffy/pull/134>`_: Fixes bug when parsing the parameters of the ligand when OPLS is used to parameterize.


1.2.0 - New tools for parameters and templates
Expand Down
28 changes: 14 additions & 14 deletions peleffy/forcefield/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ def from_ffld_output(molecule, ffld_output):
assert len(fields) > 7, 'Unexpected number of fields ' \
+ 'found at line {}'.format(line)

name_to_index[line[0:4]] = len(name_to_index)
name_to_index[line[0:8]] = len(name_to_index)

params['atom_types'].append(fields[3])
params['charges'].append(
Expand All @@ -971,8 +971,8 @@ def from_ffld_output(molecule, ffld_output):
+ 'found at line {}'.format(line)

params['bonds'].append(
{'atom1_idx': name_to_index[line[0:4]],
'atom2_idx': name_to_index[line[8:12]],
{'atom1_idx': name_to_index[line[0:8]],
'atom2_idx': name_to_index[line[8:16]],
'spring_constant': unit.Quantity(
float(fields[2]), unit.kilocalorie
/ (unit.angstrom ** 2 * unit.mole)),
Expand All @@ -986,9 +986,9 @@ def from_ffld_output(molecule, ffld_output):
+ 'found at line {}'.format(line)

params['angles'].append(
{'atom1_idx': name_to_index[line[0:4]],
'atom2_idx': name_to_index[line[8:12]],
'atom3_idx': name_to_index[line[16:20]],
{'atom1_idx': name_to_index[line[0:8]],
'atom2_idx': name_to_index[line[8:16]],
'atom3_idx': name_to_index[line[16:24]],
'spring_constant': unit.Quantity(
float(fields[3]), unit.kilocalorie
/ (unit.radian ** 2 * unit.mole)),
Expand All @@ -1001,10 +1001,10 @@ def from_ffld_output(molecule, ffld_output):
assert len(fields) > 9, 'Unexpected number of fields ' \
+ 'found at line {}'.format(line)

atom1_idx = name_to_index[line[0:4]]
atom2_idx = name_to_index[line[8:12]]
atom3_idx = name_to_index[line[16:20]]
atom4_idx = name_to_index[line[24:28]]
atom1_idx = name_to_index[line[0:8]]
atom2_idx = name_to_index[line[8:16]]
atom3_idx = name_to_index[line[16:24]]
atom4_idx = name_to_index[line[24:32]]

for k, periodicity, phase in zip(
fields[4:8], [1, 2, 3, 4],
Expand Down Expand Up @@ -1051,10 +1051,10 @@ def from_ffld_output(molecule, ffld_output):
unit.kilocalorie / unit.mole)

params['impropers'].append(
{'atom1_idx': name_to_index[line[0:4]],
'atom2_idx': name_to_index[line[8:12]],
'atom3_idx': name_to_index[line[16:20]],
'atom4_idx': name_to_index[line[24:28]],
{'atom1_idx': name_to_index[line[0:8]],
'atom2_idx': name_to_index[line[8:16]],
'atom3_idx': name_to_index[line[16:24]],
'atom4_idx': name_to_index[line[24:32]],
'periodicity': 2,
'phase': unit.Quantity(180.0, unit.degree),
'k': k / 2.0, # PELE works with half of Schrodinger's force constant
Expand Down