~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to tools/moltemplate/src/nbody_alternate_symmetry/nbody_Impropers_Jcenter_nosym.py

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from nbody_graph_search import Ugraph
 
2
 
 
3
#    To find 4-body "improper" interactions, 
 
4
#    (by default, most of the time), we would use this subgraph:
 
5
#           3
 
6
#           *                  1st bond connects atoms 0 and 1
 
7
#           |              =>  2nd bond connects atoms 0 and 2
 
8
#         _.*._                3rd bond connects atoms 0 and 3
 
9
#       *'  0  `*              
 
10
#      1         2
 
11
#
 
12
 
 
13
bond_pattern = Ugraph([(0,1), (0,2), (0,3)])
 
14
# (Ugraph atom indices begin at 0, not 1)
 
15
 
 
16
 
 
17
def canonical_order(match):
 
18
    """
 
19
    When searching for atoms with matching bond patterns GraphMatcher
 
20
    often returns redundant results. We must define a "canonical_order"
 
21
    function which sorts the atoms and bonds in a way which is consistent 
 
22
    with the type of N-body interaction being considered.
 
23
    However, some improper_styles (such as improper_style class2)
 
24
    have no symmetry (at least not for arbitrary choices of parameters).
 
25
    These force-field styles, the different permulations of atom-order
 
26
    are not equivalent.  So we do not want to rearrange the order of
 
27
    the atoms (and bonds) in the match, because the resulting interaction
 
28
    is not equivalent.  In this case, this function returns
 
29
    the original "match" argument unmodified.
 
30
 
 
31
    """
 
32
 
 
33
    return match