UFF   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 37.5%

Importance

Changes 4
Bugs 0 Features 3
Metric Value
wmc 3
c 4
b 0
f 3
dl 0
loc 29
ccs 3
cts 8
cp 0.375
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _optimize() 0 5 2
A __init__() 0 19 1
1
#! /usr/bin/env python
2
#
3
# Copyright (C) 2016 Rich Lewis <[email protected]>
4
# License: 3-clause BSD
5
6 1
"""
7
## skchem.forcefields.uff
8
9
Module specifying the universal force field.
10
"""
11 1
from rdkit.Chem.rdForceFieldHelpers import UFFOptimizeMolecule
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...
12
13 1
from .base import ForceField
14
15
16 1
class UFF(ForceField):
17
18
    """ Universal Force Field transformer. """
19
20 1
    def __init__(self, preembed=True, warn_on_fail=True, error_on_fail=False,
0 ignored issues
show
best-practice introduced by
Too many arguments (7/5)
Loading history...
21
                 add_hs=True, n_jobs=1, verbose=True):
22
23
        """ Initialize a UFF object.
24
25
        Args:
26
            preembed (bool):
27
                Whether to embed before optimizing.
28
            warn_on_fail (bool):
29
                Whether to warn if a molecule fails to optimise.
30
            error_on_fail (bool):
31
                Whether to raise an error if a molecule fails to optimise.
32
            add_hs (bool):
33
                Whether to automatically add hydrogens.
34
        """
35
36
        super(UFF, self).__init__(preembed=preembed, warn_on_fail=warn_on_fail,
37
                                  error_on_fail=error_on_fail, add_hs=add_hs,
38
                                  verbose=verbose, n_jobs=n_jobs)
39
40 1
    def _optimize(self, mol):
41
        try:
42
            return UFFOptimizeMolecule(mol)
43
        except RuntimeError:
44
            return None
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...