mirror of https://github.com/lammps/lammps.git
Update core.py
This commit is contained in:
parent
d5121bf2ee
commit
fae750391d
|
@ -210,6 +210,15 @@ class lammps(object):
|
|||
self.lib.lammps_gather_bonds.argtypes = [c_void_p,c_void_p]
|
||||
self.lib.lammps_gather_bonds.restype = None
|
||||
|
||||
self.lib.lammps_gather_angles.argtypes = [c_void_p,c_void_p]
|
||||
self.lib.lammps_gather_angles.restype = None
|
||||
|
||||
self.lib.lammps_gather_dihedrals.argtypes = [c_void_p,c_void_p]
|
||||
self.lib.lammps_gather_dihedrals.restype = None
|
||||
|
||||
self.lib.lammps_gather_impropers.argtypes = [c_void_p,c_void_p]
|
||||
self.lib.lammps_gather_impropers.restype = None
|
||||
|
||||
self.lib.lammps_gather.argtypes = [c_void_p,c_char_p,c_int,c_int,c_void_p]
|
||||
self.lib.lammps_gather.restype = None
|
||||
|
||||
|
@ -1299,6 +1308,75 @@ class lammps(object):
|
|||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
def gather_angles(self):
|
||||
"""Retrieve global list of angles
|
||||
|
||||
This is a wrapper around the :cpp:func:`lammps_gather_angles`
|
||||
function of the C-library interface.
|
||||
|
||||
This function returns a tuple with the number of angles and a
|
||||
flat list of ctypes integer values with the angle type, angle atom1,
|
||||
angle atom2, angle atom3 for each angle.
|
||||
|
||||
.. versionadded:: 28Jan2023
|
||||
|
||||
:return: a tuple with the number of angles and a list of c_int or c_long
|
||||
:rtype: (int, 4*nangles*c_tagint)
|
||||
"""
|
||||
nangles = self.extract_global("nangles")
|
||||
with ExceptionCheck(self):
|
||||
data = ((4*nangles)*self.c_tagint)()
|
||||
self.lib.lammps_gather_angles(self.lmp,data)
|
||||
return nangles,data
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
def gather_dihedrals(self):
|
||||
"""Retrieve global list of dihedrals
|
||||
|
||||
This is a wrapper around the :cpp:func:`lammps_gather_dihedrals`
|
||||
function of the C-library interface.
|
||||
|
||||
This function returns a tuple with the number of dihedrals and a
|
||||
flat list of ctypes integer values with the dihedral type, dihedral atom1,
|
||||
dihedral atom2, dihedral atom3, dihedral atom4 for each dihedral.
|
||||
|
||||
.. versionadded:: 28Jan2023
|
||||
|
||||
:return: a tuple with the number of dihedrals and a list of c_int or c_long
|
||||
:rtype: (int, 5*ndihedrals*c_tagint)
|
||||
"""
|
||||
ndihedrals = self.extract_global("ndihedrals")
|
||||
with ExceptionCheck(self):
|
||||
data = ((5*ndihedrals)*self.c_tagint)()
|
||||
self.lib.lammps_gather_dihedrals(self.lmp,data)
|
||||
return ndihedrals,data
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
def gather_impropers(self):
|
||||
"""Retrieve global list of impropers
|
||||
|
||||
This is a wrapper around the :cpp:func:`lammps_gather_impropers`
|
||||
function of the C-library interface.
|
||||
|
||||
This function returns a tuple with the number of impropers and a
|
||||
flat list of ctypes integer values with the improper type, improper atom1,
|
||||
improper atom2, improper atom3, improper atom4 for each improper.
|
||||
|
||||
.. versionadded:: 28Jan2023
|
||||
|
||||
:return: a tuple with the number of impropers and a list of c_int or c_long
|
||||
:rtype: (int, 5*nimpropers*c_tagint)
|
||||
"""
|
||||
nimpropers = self.extract_global("nimpropers")
|
||||
with ExceptionCheck(self):
|
||||
data = ((5*nimpropers)*self.c_tagint)()
|
||||
self.lib.lammps_gather_impropers(self.lmp,data)
|
||||
return nimpropers,data
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# return vector of atom/compute/fix properties gathered across procs
|
||||
# 3 variants to match src/library.cpp
|
||||
# name = atom property recognized by LAMMPS in atom->extract()
|
||||
|
|
Loading…
Reference in New Issue