How to use the mdanalysis.AtomType function in MDAnalysis

To help you get started, we’ve selected a few MDAnalysis 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 maxscheurer / pycontact / mdanalysis.py View on Github external
def parseParameterFileString(string):
        # read charmm parameter/topology file to determine AtomTypes and their AtomHBondType
        spl = string.split("!")
        name = spl[0].split()[2]
        comment = spl[1][1:]
        try:
            htype = spl[2]
        except:
            htype = "none"
        tp = AtomType(name, comment, AtomHBondType.mapping[htype])
        return tp
github maxscheurer / pycontact / mdanalysis.py View on Github external
def analyze_psf_dcd(self,psf, dcd, cutoff, hbondcutoff, hbondcutangle, sel1text, sel2text):
        # reading topology/parameter CHARMM files for setting AtomTypes and AtomHBondTypes
        heavyatomlines = []
        heavyatoms = []
        pars = open(os.path.dirname(os.path.abspath(__file__))+'/testpar.prm', 'r')
        for line in pars:
            if re.match("MASS", line):
                heavyatomlines.append(line.rstrip())
        for atomline in heavyatomlines:
            # read new AtomType and its corresponding AtomHBondType from file
            atype = AtomType.parseParameterFileString(atomline)
            # print(atomline, atype.htype)
            heavyatoms.append(atype)

        ### config (GUI settings!)

        # cutoff for contact measurement
        # cutoff = 5.0
        # cutoff for H-A distance, usually 3-3.5?(check in literature again!)
        # hbondcutoff = 3.5
        # cutoff angle for hbond, check literature again
        # hbondcutangle = 120
        ## selection texts (MDAnalysis format, not VMD!)
        # to scan for hydrogen bonds, please do NOT give selections without hydrogen atoms!
        # the computational effort is managed by the algorithm in an appropriate manner!
        # sel1text = "segid RN11"
        # sel2text = "segid UBQ"