Skip to content

Commit

Permalink
Merge pull request #18 from martimunicoy/propers_fix
Browse files Browse the repository at this point in the history
Fix proper and improper constructors
  • Loading branch information
martimunicoy committed Aug 5, 2020
2 parents 006b514 + e20bd26 commit 784f8ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion offpele/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def run_offpele(pdb_file, forcefield=DEFAULT_OFF_FORCEFIELD,
not
"""
print('-' * 60)
print('Open Force Field parameterizer for PELE v'
print('Open Force Field parameterizer for PELE '
'{}'.format(offpele.__version__))
print('-' * 60)
print(' - PDB to parameterize: {}'.format(pdb_file))
Expand Down
34 changes: 18 additions & 16 deletions offpele/topology/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,16 +748,17 @@ def _build_propers(self):
ks = self.parameters.get_dihedral_ks()
idivfs = self.parameters.get_dihedral_idivfs()

# idivf is a optional parameter in OpenForceField
if idivfs is not None:
if len(idivfs) == 0:
for period_by_index in periodicities:
idivfs.append(dict(zip(
period_by_index.keys(),
[1, ] * len(period_by_index.keys()))))
else:
# TODO in which situation these dicts are supposed to be None?
if periodicities is None or phases is None or ks is None:
return

# idivf is a optional parameter in OpenForceField
if len(idivfs) == 0:
for period_by_index in periodicities:
idivfs.append(dict(zip(
period_by_index.keys(),
[1, ] * len(period_by_index.keys()))))

assert len(periodicities) == len(phases) and \
len(periodicities) == len(ks) and \
len(periodicities) == len(idivfs), 'Unconsistent set of ' \
Expand Down Expand Up @@ -823,16 +824,17 @@ def _build_impropers(self):
ks = self.parameters.get_improper_ks()
idivfs = self.parameters.get_improper_idivfs()

# idivf is a optional parameter in OpenForceField
if idivfs is not None:
if len(idivfs) == 0:
for period_by_index in periodicities:
idivfs.append(dict(zip(
period_by_index.keys(),
[1, ] * len(period_by_index.keys()))))
else:
# TODO in which situation these dicts are supposed to be None?
if periodicities is None or phases is None or ks is None:
return

# idivf is a optional parameter in OpenForceField
if len(idivfs) == 0:
for period_by_index in periodicities:
idivfs.append(dict(zip(
period_by_index.keys(),
[1, ] * len(period_by_index.keys()))))

assert len(periodicities) == len(phases) and \
len(periodicities) == len(ks) and \
len(periodicities) == len(idivfs), 'Unconsistent set of ' \
Expand Down

0 comments on commit 784f8ef

Please sign in to comment.