Set ForceField().aromaticity_model to default, expose setter
Showing 1 of 3 files from the diff.
Newly tracked file
...enforcefield/typing/engines/smirnoff/forcefield.py
changed.
Other files ignored by Codecov
docs/releasehistory.rst
has changed.
openforcefield/tests/test_forcefield.py
has changed.
@@ -267,6 +267,7 @@
Loading
267 | 267 | def __init__( |
|
268 | 268 | self, |
|
269 | 269 | *sources, |
|
270 | + | aromaticity_model=DEFAULT_AROMATICITY_MODEL, |
|
270 | 271 | parameter_handler_classes=None, |
|
271 | 272 | parameter_io_handler_classes=None, |
|
272 | 273 | disable_version_check=False, |
@@ -285,6 +286,8 @@
Loading
285 | 286 | If multiple files are specified, any top-level tags that are repeated will be merged if they are compatible, |
|
286 | 287 | with files appearing later in the sequence resulting in parameters that have higher precedence. |
|
287 | 288 | Support for multiple files is primarily intended to allow solvent parameters to be specified by listing them last in the sequence. |
|
289 | + | aromaticity_model : string, default='OEAroModel_MDL' |
|
290 | + | The aromaticity model used by the force field. Currently, only 'OEAroModel_MDL' is supported |
|
288 | 291 | parameter_handler_classes : iterable of ParameterHandler classes, optional, default=None |
|
289 | 292 | If not None, the specified set of ParameterHandler classes will be instantiated to create the parameter object model. |
|
290 | 293 | By default, all imported subclasses of ParameterHandler are automatically registered. |
@@ -320,6 +323,7 @@
Loading
320 | 323 | # Clear all object fields |
|
321 | 324 | self._initialize() |
|
322 | 325 | ||
326 | + | self.aromaticity_model = aromaticity_model |
|
323 | 327 | # Store initialization options |
|
324 | 328 | self.disable_version_check = disable_version_check |
|
325 | 329 | # if True, we won't check which SMIRNOFF version number we're parsing |
@@ -361,7 +365,7 @@
Loading
361 | 365 | self._disable_version_check = ( |
|
362 | 366 | False # if True, will disable checking compatibility version |
|
363 | 367 | ) |
|
364 | - | self._aromaticity_model = DEFAULT_AROMATICITY_MODEL # aromaticity model |
|
368 | + | self._aromaticity_model = None |
|
365 | 369 | self._parameter_handler_classes = ( |
|
366 | 370 | OrderedDict() |
|
367 | 371 | ) # Parameter handler classes that _can_ be initialized if needed |
@@ -374,7 +378,6 @@
Loading
374 | 378 | self._parameter_io_handlers = ( |
|
375 | 379 | OrderedDict() |
|
376 | 380 | ) # ParameterIO classes to be used for each file type |
|
377 | - | self._aromaticity_model = None |
|
378 | 381 | self._author = None |
|
379 | 382 | self._date = None |
|
380 | 383 |
@@ -414,7 +417,19 @@
Loading
414 | 417 | ) |
|
415 | 418 | ) |
|
416 | 419 | ||
417 | - | def _set_aromaticity_model(self, aromaticity_model): |
|
420 | + | @property |
|
421 | + | def aromaticity_model(self): |
|
422 | + | """Returns the aromaticity model for this ForceField object. |
|
423 | + | ||
424 | + | Returns |
|
425 | + | ------- |
|
426 | + | aromaticity_model |
|
427 | + | The aromaticity model for this force field. |
|
428 | + | """ |
|
429 | + | return self._aromaticity_model |
|
430 | + | ||
431 | + | @aromaticity_model.setter |
|
432 | + | def aromaticity_model(self, aromaticity_model): |
|
418 | 433 | """ |
|
419 | 434 | Register that this forcefield is using an aromaticity model. Will check for |
|
420 | 435 | compatibility with other aromaticity model(s) already in use. |
@@ -441,17 +456,6 @@
Loading
441 | 456 | ||
442 | 457 | self._aromaticity_model = aromaticity_model |
|
443 | 458 | ||
444 | - | @property |
|
445 | - | def aromaticity_model(self): |
|
446 | - | """Returns the aromaticity model for this ForceField object. |
|
447 | - | ||
448 | - | Returns |
|
449 | - | ------- |
|
450 | - | aromaticity_model |
|
451 | - | The aromaticity model for this force field. |
|
452 | - | """ |
|
453 | - | return self._aromaticity_model |
|
454 | - | ||
455 | 459 | def _add_author(self, author): |
|
456 | 460 | """ |
|
457 | 461 | Add an author to this forcefield. If this functional is called multiple times, all provided authors |
@@ -964,7 +968,7 @@
Loading
964 | 968 | # others loaded by this ForceField |
|
965 | 969 | if "aromaticity_model" in smirnoff_data["SMIRNOFF"]: |
|
966 | 970 | aromaticity_model = smirnoff_data["SMIRNOFF"]["aromaticity_model"] |
|
967 | - | self._set_aromaticity_model(aromaticity_model) |
|
971 | + | self.aromaticity_model = aromaticity_model |
|
968 | 972 | ||
969 | 973 | elif self._aromaticity_model is None: |
|
970 | 974 | raise ParseError( |
Files | Coverage |
---|---|
openforcefield | 70.80% |
Project Totals (18 files) | 70.80% |
239710028
239710028
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.