Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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"