diff --git a/docs/releasehistory.rst b/docs/releasehistory.rst index c153d9a2..25693644 100644 --- a/docs/releasehistory.rst +++ b/docs/releasehistory.rst @@ -13,6 +13,7 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 `_: Some format errors in the API documentation are fixed. Links to the PELE documentation are updated. +- `PR #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 diff --git a/peleffy/forcefield/parameters.py b/peleffy/forcefield/parameters.py index ad1c7265..93c6801d 100644 --- a/peleffy/forcefield/parameters.py +++ b/peleffy/forcefield/parameters.py @@ -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( @@ -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)), @@ -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)), @@ -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], @@ -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