How to use the moltemplate.lttree_styles.ColNames2AidAtypeMolid function in moltemplate

To help you get started, we’ve selected a few moltemplate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jewettaij / moltemplate / moltemplate / lttree.py View on Github external
#                 '##      indicating the column numbers for the x,y,z   ##\n'
                         #                 '##      coordinates of each atom.                     ##\n'
                         #                 '##   4) Use the -ivect \"cmux cmuy cmuz...\" argument   ##\n'
                         #                 '##      where \"cmux cmuy cmuz...\" is a list of        ##\n'
                         #                 '##      integers indicating the column numbers for    ##\n'
                         #                 '##      the vector that determines the direction of a ##\n'
                         #                 '##      dipole or ellipsoid (ie. a rotateable vector).##\n'
                         #                 '##      (More than one triplet can be specified. The  ##\n'
                         #                 '##       number of entries must be divisible by 3.)   ##\n'
                         '########################################################\n')

        # The default atom_style is "full"
        settings.column_names = AtomStyle2ColNames('full')
        settings.ii_coords = ColNames2Coords(settings.column_names)
        settings.ii_vects = ColNames2Vects(settings.column_names)
        settings.i_atomid, settings.i_atomtype, settings.i_molid = ColNames2AidAtypeMolid(
            settings.column_names)

    return
github jewettaij / moltemplate / moltemplate / bonds_by_type.py View on Github external
...a list of bonded pairs of atoms
        stored in the lines_bonds variable (from the "Data Bond List"
                                       or "Data Bonds AtomId AtomId" sections)
    ...and a list of atom types
        stored in the lines_atoms variable (from the "Data Atoms" section)
    ...and a list of bond-types-as-a-function-of-atom-types
        stored in the lines_bondsbytype (from the "Data Bonds By Type" section)

    Generated bond_ids (if applicable) are of the form
      prefix + str(number) + suffix
        (where "number" begins at bond_ids_offset+1)

    """

    column_names = AtomStyle2ColNames(atom_style)
    i_atomid, i_atomtype, i_molid = ColNames2AidAtypeMolid(column_names)

    atomids = []
    atomtypes = []
    atomids2types = {}

    for iv in range(0, len(lines_atoms)):
        line = lines_atoms[iv].strip()
        if '#' in line:
            icomment = line.find('#')
            line = (line[:icomment]).strip()
        if len(line) > 0:
            tokens = ttree_lex.SplitQuotedString(line)
            if ((len(tokens) <= i_atomid) or (len(tokens) <= i_atomtype)):
                sys.stderr.write("\"" + line + "\"\n")
                raise(ttree_lex.InputError(
                    'Error not enough columns on line ' + str(iv + 1) + ' of \"Atoms\" section.'))
github jewettaij / moltemplate / moltemplate / nbody_by_type.py View on Github external
def GenInteractions_lines(lines_atoms,
                          lines_bonds,
                          lines_nbody,
                          lines_nbodybytype,
                          atom_style,
                          g_bond_pattern,
                          canonical_order,  # function to sort atoms and bonds
                          prefix='',
                          suffix='',
                          report_progress=False,
                          check_undefined=False):

    column_names = AtomStyle2ColNames(atom_style)
    i_atomid, i_atomtype, i_molid = ColNames2AidAtypeMolid(column_names)

    atomids_str = []
    atomtypes_str = []

    for iv in range(0, len(lines_atoms)):
        line = lines_atoms[iv].strip()
        if '#' in line:
            icomment = line.find('#')
            line = (line[:icomment]).strip()
        if len(line) > 0:
            tokens = SplitQuotedString(line)
            if ((len(tokens) <= i_atomid) or (len(tokens) <= i_atomtype)):
                raise(InputError('Error not enough columns on line ' +
                                 str(iv + 1) + ' of \"Atoms\" section.'))
            tokens = SplitQuotedString(line)
            atomids_str.append(EscCharStrToChar(tokens[i_atomid]))
github jewettaij / moltemplate / moltemplate / charge_by_bond.py View on Github external
Input (continued):
       This function requires:
    ...a list of bonded pairs of atoms
        stored in the lines_bonds variable (from the "Data Bond List"
                                       or "Data Bonds AtomId AtomId" sections)
    ...and a list of atom types
        stored in the lines_atoms variable (from the "Data Atoms" section)

    ...and a list of charge-pairs-as-a-function-of-atom-types
        stored in the lines_chargebybond (from the "Data Bonds By Type" section)

    """

    column_names = AtomStyle2ColNames(atom_style)
    i_atomid, i_atomtype, i_molid = ColNames2AidAtypeMolid(column_names)

    atomids = []
    atomtypes = []
    atomids2types = {}

    for iv in range(0, len(lines_atoms)):
        line = lines_atoms[iv].strip()
        if '#' in line:
            icomment = line.find('#')
            line = (line[:icomment]).strip()
        if len(line) > 0:
            tokens = ttree_lex.SplitQuotedString(line)
            if ((len(tokens) <= i_atomid) or (len(tokens) <= i_atomtype)):
                sys.stderr.write("\"" + line + "\"\n")
                raise(ttree_lex.InputError(
                    'Error not enough columns on line ' + str(iv + 1) + ' of \"Atoms\" section.'))