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

General code improvements #36

Merged
merged 2 commits into from
Sep 1, 2020
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 @@ -17,6 +17,7 @@ New features
""""""""""""
- `PR #28 <https://github.com/martimunicoy/offpele/pull/28>`_: Adds a new method to define a `Molecule` object through a SMILES tag. This molecule can be written as a PDB file later for PELE.
- `PR #31 <https://github.com/martimunicoy/offpele/pull/31>`_: Adds the possibility to combine nonbonding and solvent parameters from OPLS2005 with bonding parameters from OFF.
- `PR #36 <https://github.com/martimunicoy/offpele/pull/36>`_: Minor changes to improve the quality of the code.

Bugfixes
""""""""
Expand Down
6 changes: 6 additions & 0 deletions offpele/topology/zmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __new__(cls, molecule):

return obj

@staticmethod
def _extract_coords(molecule):
"""
It extracts the coordinates of the molecule's atoms.
Expand All @@ -65,6 +66,7 @@ def _extract_coords(molecule):

return coords

@staticmethod
def _get_absolute_parent(molecule):
"""
It returns the absolute parent in the topology of the molecule.
Expand All @@ -88,6 +90,7 @@ def _get_absolute_parent(molecule):

return absolute_parent[0]

@staticmethod
def _calculate_bond(x1, y1, z1, x2, y2, z2):
"""
It calculates the bond distance between two sets of coordinates.
Expand Down Expand Up @@ -118,6 +121,7 @@ def _calculate_bond(x1, y1, z1, x2, y2, z2):

return np.sqrt(dx * dx + dy * dy + dz * dz)

@staticmethod
def _calculate_angle(x1, y1, z1, x2, y2, z2, x3, y3, z3):
"""
It calculates the angle between three sets of coordinates.
Expand Down Expand Up @@ -172,6 +176,7 @@ def _calculate_angle(x1, y1, z1, x2, y2, z2, x3, y3, z3):

return np.arccos(xang) * 180.0 / np.pi

@staticmethod
def _calculate_dihedral(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4):
"""
It calculates the dihedral between four sets of coordinates.
Expand Down Expand Up @@ -246,6 +251,7 @@ def _calculate_dihedral(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4):

return phi * 180.0 / np.pi

@staticmethod
def _build_zmatrix(cls, obj, coords, molecule):
"""
It buils the zmatrix.
Expand Down
10 changes: 9 additions & 1 deletion offpele/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
This module contains miscellaneous set of handy classes and functions.
"""


__all__ = ["get_data_file_path",
"temporary_cd",
"warning_on_one_line",
"check_if_path_exists",
"create_path"
]


from pkg_resources import resource_filename
import os
import contextlib
Expand Down Expand Up @@ -83,5 +92,4 @@ def create_path(path):
path : str
The path that will be created
"""
import os
os.makedirs(str(path), exist_ok=True)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from os.path import relpath, join
from setuptools import setup, find_packages
from setuptools import setup
import versioneer


Expand Down Expand Up @@ -32,7 +32,7 @@ def find_package_data(data_root, package_root):
'offpele/solvent',
'offpele/topology',
'offpele/utils',
],
],
long_description=read('README.md'),
classifiers=[
"Development Status :: 1 - Planning",
Expand Down