Skip to content

Commit

Permalink
FIX: set empty atom groups for WC
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcello-Sega committed Dec 6, 2023
1 parent 154edc4 commit c805160
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions pytim/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def _assign_layers(self):

@property
def atoms(self):
if len(self._layers) == 0: return self._layers # an empty atom group
return self._layers[:].sum()

@property
Expand Down
16 changes: 14 additions & 2 deletions pytim/willard_chandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

class WillardChandler(Interface):
""" Identifies the dividing surface using the Willard-Chandler method
NOTE that this method does *not* identify surface atoms
*(Willard, A. P.; Chandler, D. J. Phys. Chem. B 2010, 114, 1954–1958)*
Expand Down Expand Up @@ -83,9 +84,20 @@ class WillardChandler(Interface):
@property
def layers(self):
""" The method does not identify layers.
Example:
>>> import MDAnalysis as mda
>>> import pytim
>>> from pytim.datafiles import *
>>>
>>> u = mda.Universe(MICELLE_PDB)
>>> g = u.select_atoms('resname DPC')
>>> inter= pytim.WillardChandler(u, group=g, alpha=3.0, fast=True)
>>> inter.layers
<AtomGroup with 0 atoms>
"""
self.layers = None
return None
return self._layers

def _sanity_checks(self):
""" Basic checks to be performed after the initialization.
Expand Down

0 comments on commit c805160

Please sign in to comment.