Completed
Push — master ( 4cde57...24f8d3 )
by Rich
01:30
created

MMFF   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A optimize() 0 13 4
1
#! /usr/bin/env python
2
#
3
# Copyright (C) 2015 Rich Lewis <[email protected]>
4
# License: 3-clause BSD
5
6
"""
7
## skchem.forcefields.mmff
8
9
Module specifying the Merck Molecular Force Field.
10
"""
11
import warnings
12
13
from rdkit.Chem.rdForceFieldHelpers import MMFFOptimizeMolecule
0 ignored issues
show
Configuration introduced by
The import rdkit.Chem.rdForceFieldHelpers could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
14
from .base import ForceField
15
16
17
class MMFF(ForceField):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
18
    def optimize(self, mol):
19
        res = MMFFOptimizeMolecule(mol)
20
21
        if res == -1:
22
            msg = 'Failed to optimize molecule \'{}\' using MMFF'.format(mol.name)
23
            if self.error_on_fail:
24
                raise RuntimeError(msg)
25
            elif self.warn_on_fail:
26
                warnings.warn(msg)
27
            else:
28
                pass
29
30
        return mol
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...