Skip to content

How to use ACPYPE API

Alan Silva edited this page Dec 22, 2021 · 3 revisions

Using ACPYPE API

(check here if you like Jupyter)

  1. Be sure your have latest acpype
  2. Be sure you have in your PYTHONPATH .../acpype/scripts

For calculating topologies via antechamber

(see details in CcpnToAcpype.py, but it's old and in Python2!)

from acpype.topol import header, ACTopol
dir(ACTopol)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__metaclass__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'balanceCharges', 'checkFrcmod', 'checkLeapLog', 'checkSmiles', 'checkXyzAndTopFiles', 'convertPdbToMol2', 'convertSmilesToMol2', 'createACTopol', 'createMolTopol', 'delOutputFiles', 'execAntechamber', 'execObabel', 'execParmchk', 'execTleap', 'getABCOEFs', 'getAngles', 'getAtoms', 'getBonds', 'getChirals', 'getCoords', 'getDihedrals', 'getFlagData', 'getResidueLabel', 'guessCharge', 'locateDat', 'makeDir', 'pickleSave', 'printDebug', 'printError', 'printMess', 'printQuoted', 'printWarn', 'readMol2TotalCharge', 'search', 'setAtomType4Gromacs', 'setProperDihedralsCoef', 'setResNameCheckCoords', 'signal_handler', 'sortAtomsForGromacs', 'writeCharmmTopolFiles', 'writeCnsTopolFiles', 'writeGroFile', 'writeGromacsTop', 'writeGromacsTopolFiles', 'writeMdpFiles', 'writePdb', 'writePosreFile']

print(ACTopol.__doc__)

        Class to build the AC topologies (Antechamber AmberTools)

molecule = ACTopol(inputFile,...)
molecule.createACTopol()
molecule.createMolTopol()

For an example of ACPYPE amb2gmx feature

from acpype import topol
mol = topol.MolTopol(acFileXyz='FFF_AC.inpcrd', acFileTop='FFF_AC.prmtop') 
# there many other parameters if you want

e.g:

mol = topol.MolTopol(acFileXyz='FFF.acpype/FFF_AC.inpcrd', acFileTop='FFF.acpype/FFF_AC.prmtop', debug=True, amb2gmx=True)
DEBUG: prmtop and inpcrd files loaded
DEBUG: basename defined = 'PHE'
DEBUG: getCoords done
DEBUG: getABCOEFs done
DEBUG: charge to be balanced: total -0.0000019985
DEBUG: balanceCharges done
DEBUG: Balanced TotalCharge -0.0000000000
DEBUG: PBC = None
DEBUG: getAtoms done
DEBUG: getBonds done
DEBUG: getAngles done
DEBUG: getDihedrals done

mol.writeGromacsTopolFiles()
==> Writing GROMACS files

==> Disambiguating lower and uppercase atomtypes in GMX top file, even if identical.

DEBUG: writing GRO file
DEBUG: Box size estimated
DEBUG: writing POSRE file
DEBUG: atomTypes 11
DEBUG: GMX atomtypes done
DEBUG: atoms 63
DEBUG: GMX atoms done
DEBUG: bonds 65
DEBUG: GMX bonds done
DEBUG: atomPairs 155
DEBUG: GMX pairs done
DEBUG: angles 111
DEBUG: GMX angles done
DEBUG: setProperDihedralsCoef done
DEBUG: properDihedralsCoefRB 164
DEBUG: properDihedralsAlphaGamma 0
DEBUG: properDihedralsGmx45 188
==> Writing GMX dihedrals for GMX 4.5 and higher.

DEBUG: GMX special proper dihedrals done
DEBUG: improperDihedrals 23
DEBUG: GMX improper dihedrals done

(updated on 22 Dec 2021)