frag_pele/PlopRotTemp_S_2017/PlopRotTemp.py
def assign_group(bonds, rank):
    """
      |
      **Description:** With the core atom and its rank defined
      grouped the atoms in cluster or rotatable chains.

      **Input:**
        - bonds: all bonds
        - rank: core atom rank

      **Output:**
        - group: groups of rotatable chains
    """
    group = []
    cur_group = -1
    for i in range(len(rank)):
        if (rank[i] == 0):
            group.append(-1)  # core atoms
        else:
            group.append(-2)  # unknown group
    while ( min_value(group) < -1 ):
        # Find an atom of rank 1 that is not assigned 
        cur_atom = -1
        for i in range(len(rank)):
            if (rank[i] == 1 and group[i] == -2):
                cur_atom = i;
                cur_group = cur_group + 1;
                group[i] = cur_group;
                break;
        atoms_in_group = 1
        if (cur_atom == -1):
          print("ERROR 2042!!")
        edit_any = 1;
        # Find all connected atoms of rank >= 1
        while (edit_any == 1):
            edit_any = 0
            for i in range(len(bonds)):
                if ( group[bonds[i][0]] == cur_group and group[bonds[i][1]] == -2):
                    group[bonds[i][1]] = cur_group;
                    atoms_in_group = atoms_in_group + 1;
                    edit_any = 1;
                if ( group[bonds[i][1]] == cur_group and group[bonds[i][0]] == -2):
                    group[bonds[i][0]] = cur_group;
                    atoms_in_group = atoms_in_group + 1;
                    edit_any = 1;
        if (atoms_in_group == 1):  # if there is one atom then it goes with the core
            for i in range(len(group)):
                if (group[i] == cur_group): group[i] = -1;
            cur_groups = cur_group - 1
    return group

      |
      **Description:** With the core atom and its rank defined
      grouped the atoms in cluster or rotatable chains.

      **Input:**
        - bonds: all bonds
        - rank: core atom rank

      **Output:**
        - group: groups of rotatable chains
    
|
Description:** With the core atom and its rank defined
grouped the atoms in cluster or rotatable chains.

all bonds
rank: core atom rank

groups of rotatable chains
| Description : ** With the core atom and its rank defined grouped the atoms in cluster or rotatable chains . all bonds rank : core atom rank groups of rotatable chains
def assign_group(bonds, rank):
    group = []
    cur_group = -1
    for i in range(len(rank)):
        if (rank[i] == 0):
            group.append(-1)  
        else:
            group.append(-2)  
    while ( min_value(group) < -1 ):
        cur_atom = -1
        for i in range(len(rank)):
            if (rank[i] == 1 and group[i] == -2):
                cur_atom = i;
                cur_group = cur_group + 1;
                group[i] = cur_group;
                break;
        atoms_in_group = 1
        if (cur_atom == -1):
          print("ERROR 2042!!")
        edit_any = 1;
        while (edit_any == 1):
            edit_any = 0
            for i in range(len(bonds)):
                if ( group[bonds[i][0]] == cur_group and group[bonds[i][1]] == -2):
                    group[bonds[i][1]] = cur_group;
                    atoms_in_group = atoms_in_group + 1;
                    edit_any = 1;
                if ( group[bonds[i][1]] == cur_group and group[bonds[i][0]] == -2):
                    group[bonds[i][0]] = cur_group;
                    atoms_in_group = atoms_in_group + 1;
                    edit_any = 1;
        if (atoms_in_group == 1):  
            for i in range(len(group)):
                if (group[i] == cur_group): group[i] = -1;
            cur_groups = cur_group - 1
    return group
def assign_group ( bonds , rank ) : group = [ ] cur_group = - 1 for i in range ( len ( rank ) ) : if ( rank [ i ] == 0 ) : group . append ( - 1 ) else : group . append ( - 2 ) while ( min_value ( group ) < - 1 ) : cur_atom = - 1 for i in range ( len ( rank ) ) : if ( rank [ i ] == 1 and group [ i ] == - 2 ) : cur_atom = i ; cur_group = cur_group + 1 ; group [ i ] = cur_group ; break ; atoms_in_group = 1 if ( cur_atom == - 1 ) : print ( "ERROR 2042!!" ) edit_any = 1 ; while ( edit_any == 1 ) : edit_any = 0 for i in range ( len ( bonds ) ) : if ( group [ bonds [ i ] [ 0 ] ] == cur_group and group [ bonds [ i ] [ 1 ] ] == - 2 ) : group [ bonds [ i ] [ 1 ] ] = cur_group ; atoms_in_group = atoms_in_group + 1 ; edit_any = 1 ; if ( group [ bonds [ i ] [ 1 ] ] == cur_group and group [ bonds [ i ] [ 0 ] ] == - 2 ) : group [ bonds [ i ] [ 0 ] ] = cur_group ; atoms_in_group = atoms_in_group + 1 ; edit_any = 1 ; if ( atoms_in_group == 1 ) : for i in range ( len ( group ) ) : if ( group [ i ] == cur_group ) : group [ i ] = - 1 ; cur_groups = cur_group - 1 return group
|
Description:** With the core atom and its rank defined
grouped the atoms in cluster or rotatable chains.
| Description : ** With the core atom and its rank defined grouped the atoms in cluster or rotatable chains .
"""
      |
      **Description:** With the core atom and its rank defined
      grouped the atoms in cluster or rotatable chains.

      **Input:**
        - bonds: all bonds
        - rank: core atom rank

      **Output:**
        - group: groups of rotatable chains
    """ # core atoms # unknown group # Find an atom of rank 1 that is not assigned  # Find all connected atoms of rank >= 1 # if there is one atom then it goes with the core
bonds
rank