id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
51
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
241,300
pyusb/pyusb
tools/vcp_terminal.py
ftdi_to_clkbits
def ftdi_to_clkbits(baudrate): # from libftdi """ 10,27 => divisor = 10000, rate = 300 88,13 => divisor = 5000, rate = 600 C4,09 => divisor = 2500, rate = 1200 E2,04 => divisor = 1250, rate = 2,400 71,02 => divisor = 625, rate = 4,800 38,41 => divisor = 312.5, rate = 9,600 D0,80 => divi...
python
def ftdi_to_clkbits(baudrate): # from libftdi clk = 48000000 clk_div = 16 frac_code = [0, 3, 2, 4, 1, 5, 6, 7] actual_baud = 0 if baudrate >= clk / clk_div: encoded_divisor = 0 actual_baud = (clk // clk_div) elif baudrate >= clk / (clk_div + clk_div / 2): encoded_divisor...
[ "def", "ftdi_to_clkbits", "(", "baudrate", ")", ":", "# from libftdi", "clk", "=", "48000000", "clk_div", "=", "16", "frac_code", "=", "[", "0", ",", "3", ",", "2", ",", "4", ",", "1", ",", "5", ",", "6", ",", "7", "]", "actual_baud", "=", "0", "...
10,27 => divisor = 10000, rate = 300 88,13 => divisor = 5000, rate = 600 C4,09 => divisor = 2500, rate = 1200 E2,04 => divisor = 1250, rate = 2,400 71,02 => divisor = 625, rate = 4,800 38,41 => divisor = 312.5, rate = 9,600 D0,80 => divisor = 208.25, rate = 14406 9C,80 => divisor = 156, rate...
[ "10", "27", "=", ">", "divisor", "=", "10000", "rate", "=", "300", "88", "13", "=", ">", "divisor", "=", "5000", "rate", "=", "600", "C4", "09", "=", ">", "divisor", "=", "2500", "rate", "=", "1200", "E2", "04", "=", ">", "divisor", "=", "1250"...
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/tools/vcp_terminal.py#L576-L617
241,301
pyusb/pyusb
tools/vcp_terminal.py
ComPort._read
def _read(self): """ check ep for data, add it to queue and sleep for interval """ while self._rxactive: try: rv = self._ep_in.read(self._ep_in.wMaxPacketSize) if self._isFTDI: status = rv[:2] # FTDI prepends 2 flow control characters, ...
python
def _read(self): while self._rxactive: try: rv = self._ep_in.read(self._ep_in.wMaxPacketSize) if self._isFTDI: status = rv[:2] # FTDI prepends 2 flow control characters, # modem status and line status of the UART ...
[ "def", "_read", "(", "self", ")", ":", "while", "self", ".", "_rxactive", ":", "try", ":", "rv", "=", "self", ".", "_ep_in", ".", "read", "(", "self", ".", "_ep_in", ".", "wMaxPacketSize", ")", "if", "self", ".", "_isFTDI", ":", "status", "=", "rv"...
check ep for data, add it to queue and sleep for interval
[ "check", "ep", "for", "data", "add", "it", "to", "queue", "and", "sleep", "for", "interval" ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/tools/vcp_terminal.py#L187-L206
241,302
pyusb/pyusb
tools/vcp_terminal.py
ComPort._resetFTDI
def _resetFTDI(self): """ reset the FTDI device """ if not self._isFTDI: return txdir = 0 # 0:OUT, 1:IN req_type = 2 # 0:std, 1:class, 2:vendor recipient = 0 # 0:device, 1:interface, 2:endpoint, 3:other req_type = (txdir << 7) + ...
python
def _resetFTDI(self): if not self._isFTDI: return txdir = 0 # 0:OUT, 1:IN req_type = 2 # 0:std, 1:class, 2:vendor recipient = 0 # 0:device, 1:interface, 2:endpoint, 3:other req_type = (txdir << 7) + (req_type << 5) + recipient self.devic...
[ "def", "_resetFTDI", "(", "self", ")", ":", "if", "not", "self", ".", "_isFTDI", ":", "return", "txdir", "=", "0", "# 0:OUT, 1:IN", "req_type", "=", "2", "# 0:std, 1:class, 2:vendor", "recipient", "=", "0", "# 0:device, 1:interface, 2:endpoint, 3:other", "req_type",...
reset the FTDI device
[ "reset", "the", "FTDI", "device" ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/tools/vcp_terminal.py#L359-L373
241,303
pyusb/pyusb
usb/legacy.py
busses
def busses(): r"""Returns a tuple with the usb busses.""" return (Bus(g) for k, g in groupby( sorted(core.find(find_all=True), key=lambda d: d.bus), lambda d: d.bus))
python
def busses(): r"""Returns a tuple with the usb busses.""" return (Bus(g) for k, g in groupby( sorted(core.find(find_all=True), key=lambda d: d.bus), lambda d: d.bus))
[ "def", "busses", "(", ")", ":", "return", "(", "Bus", "(", "g", ")", "for", "k", ",", "g", "in", "groupby", "(", "sorted", "(", "core", ".", "find", "(", "find_all", "=", "True", ")", ",", "key", "=", "lambda", "d", ":", "d", ".", "bus", ")",...
r"""Returns a tuple with the usb busses.
[ "r", "Returns", "a", "tuple", "with", "the", "usb", "busses", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L337-L341
241,304
pyusb/pyusb
usb/legacy.py
DeviceHandle.bulkWrite
def bulkWrite(self, endpoint, buffer, timeout = 100): r"""Perform a bulk write request to the endpoint specified. Arguments: endpoint: endpoint number. buffer: sequence data buffer to write. This parameter can be any sequence type. ...
python
def bulkWrite(self, endpoint, buffer, timeout = 100): r"""Perform a bulk write request to the endpoint specified. Arguments: endpoint: endpoint number. buffer: sequence data buffer to write. This parameter can be any sequence type. ...
[ "def", "bulkWrite", "(", "self", ",", "endpoint", ",", "buffer", ",", "timeout", "=", "100", ")", ":", "return", "self", ".", "dev", ".", "write", "(", "endpoint", ",", "buffer", ",", "timeout", ")" ]
r"""Perform a bulk write request to the endpoint specified. Arguments: endpoint: endpoint number. buffer: sequence data buffer to write. This parameter can be any sequence type. timeout: operation timeout in milliseconds. (default: 100...
[ "r", "Perform", "a", "bulk", "write", "request", "to", "the", "endpoint", "specified", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L131-L141
241,305
pyusb/pyusb
usb/legacy.py
DeviceHandle.bulkRead
def bulkRead(self, endpoint, size, timeout = 100): r"""Performs a bulk read request to the endpoint specified. Arguments: endpoint: endpoint number. size: number of bytes to read. timeout: operation timeout in milliseconds. (default: 100) ...
python
def bulkRead(self, endpoint, size, timeout = 100): r"""Performs a bulk read request to the endpoint specified. Arguments: endpoint: endpoint number. size: number of bytes to read. timeout: operation timeout in milliseconds. (default: 100) ...
[ "def", "bulkRead", "(", "self", ",", "endpoint", ",", "size", ",", "timeout", "=", "100", ")", ":", "return", "self", ".", "dev", ".", "read", "(", "endpoint", ",", "size", ",", "timeout", ")" ]
r"""Performs a bulk read request to the endpoint specified. Arguments: endpoint: endpoint number. size: number of bytes to read. timeout: operation timeout in milliseconds. (default: 100) Returns a tuple with the data read.
[ "r", "Performs", "a", "bulk", "read", "request", "to", "the", "endpoint", "specified", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L143-L152
241,306
pyusb/pyusb
usb/legacy.py
DeviceHandle.interruptWrite
def interruptWrite(self, endpoint, buffer, timeout = 100): r"""Perform a interrupt write request to the endpoint specified. Arguments: endpoint: endpoint number. buffer: sequence data buffer to write. This parameter can be any sequence type. ...
python
def interruptWrite(self, endpoint, buffer, timeout = 100): r"""Perform a interrupt write request to the endpoint specified. Arguments: endpoint: endpoint number. buffer: sequence data buffer to write. This parameter can be any sequence type. ...
[ "def", "interruptWrite", "(", "self", ",", "endpoint", ",", "buffer", ",", "timeout", "=", "100", ")", ":", "return", "self", ".", "dev", ".", "write", "(", "endpoint", ",", "buffer", ",", "timeout", ")" ]
r"""Perform a interrupt write request to the endpoint specified. Arguments: endpoint: endpoint number. buffer: sequence data buffer to write. This parameter can be any sequence type. timeout: operation timeout in milliseconds. (default...
[ "r", "Perform", "a", "interrupt", "write", "request", "to", "the", "endpoint", "specified", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L154-L164
241,307
pyusb/pyusb
usb/legacy.py
DeviceHandle.interruptRead
def interruptRead(self, endpoint, size, timeout = 100): r"""Performs a interrupt read request to the endpoint specified. Arguments: endpoint: endpoint number. size: number of bytes to read. timeout: operation timeout in milliseconds. (default: 100) ...
python
def interruptRead(self, endpoint, size, timeout = 100): r"""Performs a interrupt read request to the endpoint specified. Arguments: endpoint: endpoint number. size: number of bytes to read. timeout: operation timeout in milliseconds. (default: 100) ...
[ "def", "interruptRead", "(", "self", ",", "endpoint", ",", "size", ",", "timeout", "=", "100", ")", ":", "return", "self", ".", "dev", ".", "read", "(", "endpoint", ",", "size", ",", "timeout", ")" ]
r"""Performs a interrupt read request to the endpoint specified. Arguments: endpoint: endpoint number. size: number of bytes to read. timeout: operation timeout in milliseconds. (default: 100) Returns a tuple with the data read.
[ "r", "Performs", "a", "interrupt", "read", "request", "to", "the", "endpoint", "specified", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L166-L175
241,308
pyusb/pyusb
usb/legacy.py
DeviceHandle.controlMsg
def controlMsg(self, requestType, request, buffer, value = 0, index = 0, timeout = 100): r"""Perform a control request to the default control pipe on a device. Arguments: requestType: specifies the direction of data flow, the type of request, and the recipient. ...
python
def controlMsg(self, requestType, request, buffer, value = 0, index = 0, timeout = 100): r"""Perform a control request to the default control pipe on a device. Arguments: requestType: specifies the direction of data flow, the type of request, and the recipient. ...
[ "def", "controlMsg", "(", "self", ",", "requestType", ",", "request", ",", "buffer", ",", "value", "=", "0", ",", "index", "=", "0", ",", "timeout", "=", "100", ")", ":", "return", "self", ".", "dev", ".", "ctrl_transfer", "(", "requestType", ",", "r...
r"""Perform a control request to the default control pipe on a device. Arguments: requestType: specifies the direction of data flow, the type of request, and the recipient. request: specifies the request. buffer: if the transfer is a write transfer, ...
[ "r", "Perform", "a", "control", "request", "to", "the", "default", "control", "pipe", "on", "a", "device", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L177-L198
241,309
pyusb/pyusb
usb/legacy.py
DeviceHandle.claimInterface
def claimInterface(self, interface): r"""Claims the interface with the Operating System. Arguments: interface: interface number or an Interface object. """ if isinstance(interface, Interface): interface = interface.interfaceNumber util.claim_interface(se...
python
def claimInterface(self, interface): r"""Claims the interface with the Operating System. Arguments: interface: interface number or an Interface object. """ if isinstance(interface, Interface): interface = interface.interfaceNumber util.claim_interface(se...
[ "def", "claimInterface", "(", "self", ",", "interface", ")", ":", "if", "isinstance", "(", "interface", ",", "Interface", ")", ":", "interface", "=", "interface", ".", "interfaceNumber", "util", ".", "claim_interface", "(", "self", ".", "dev", ",", "interfac...
r"""Claims the interface with the Operating System. Arguments: interface: interface number or an Interface object.
[ "r", "Claims", "the", "interface", "with", "the", "Operating", "System", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L208-L218
241,310
pyusb/pyusb
usb/legacy.py
DeviceHandle.releaseInterface
def releaseInterface(self): r"""Release an interface previously claimed with claimInterface.""" util.release_interface(self.dev, self.__claimed_interface) self.__claimed_interface = -1
python
def releaseInterface(self): r"""Release an interface previously claimed with claimInterface.""" util.release_interface(self.dev, self.__claimed_interface) self.__claimed_interface = -1
[ "def", "releaseInterface", "(", "self", ")", ":", "util", ".", "release_interface", "(", "self", ".", "dev", ",", "self", ".", "__claimed_interface", ")", "self", ".", "__claimed_interface", "=", "-", "1" ]
r"""Release an interface previously claimed with claimInterface.
[ "r", "Release", "an", "interface", "previously", "claimed", "with", "claimInterface", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L220-L223
241,311
pyusb/pyusb
usb/legacy.py
DeviceHandle.setConfiguration
def setConfiguration(self, configuration): r"""Set the active configuration of a device. Arguments: configuration: a configuration value or a Configuration object. """ if isinstance(configuration, Configuration): configuration = configuration.value self.d...
python
def setConfiguration(self, configuration): r"""Set the active configuration of a device. Arguments: configuration: a configuration value or a Configuration object. """ if isinstance(configuration, Configuration): configuration = configuration.value self.d...
[ "def", "setConfiguration", "(", "self", ",", "configuration", ")", ":", "if", "isinstance", "(", "configuration", ",", "Configuration", ")", ":", "configuration", "=", "configuration", ".", "value", "self", ".", "dev", ".", "set_configuration", "(", "configurati...
r"""Set the active configuration of a device. Arguments: configuration: a configuration value or a Configuration object.
[ "r", "Set", "the", "active", "configuration", "of", "a", "device", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L238-L247
241,312
pyusb/pyusb
usb/legacy.py
DeviceHandle.setAltInterface
def setAltInterface(self, alternate): r"""Sets the active alternate setting of the current interface. Arguments: alternate: an alternate setting number or an Interface object. """ if isinstance(alternate, Interface): alternate = alternate.alternateSetting ...
python
def setAltInterface(self, alternate): r"""Sets the active alternate setting of the current interface. Arguments: alternate: an alternate setting number or an Interface object. """ if isinstance(alternate, Interface): alternate = alternate.alternateSetting ...
[ "def", "setAltInterface", "(", "self", ",", "alternate", ")", ":", "if", "isinstance", "(", "alternate", ",", "Interface", ")", ":", "alternate", "=", "alternate", ".", "alternateSetting", "self", ".", "dev", ".", "set_interface_altsetting", "(", "self", ".", ...
r"""Sets the active alternate setting of the current interface. Arguments: alternate: an alternate setting number or an Interface object.
[ "r", "Sets", "the", "active", "alternate", "setting", "of", "the", "current", "interface", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L249-L258
241,313
pyusb/pyusb
usb/legacy.py
DeviceHandle.getString
def getString(self, index, length, langid = None): r"""Retrieve the string descriptor specified by index and langid from a device. Arguments: index: index of descriptor in the device. length: number of bytes of the string (ignored) langid: Language ID. If...
python
def getString(self, index, length, langid = None): r"""Retrieve the string descriptor specified by index and langid from a device. Arguments: index: index of descriptor in the device. length: number of bytes of the string (ignored) langid: Language ID. If...
[ "def", "getString", "(", "self", ",", "index", ",", "length", ",", "langid", "=", "None", ")", ":", "return", "util", ".", "get_string", "(", "self", ".", "dev", ",", "index", ",", "langid", ")", ".", "encode", "(", "'ascii'", ")" ]
r"""Retrieve the string descriptor specified by index and langid from a device. Arguments: index: index of descriptor in the device. length: number of bytes of the string (ignored) langid: Language ID. If it is omitted, the first language will...
[ "r", "Retrieve", "the", "string", "descriptor", "specified", "by", "index", "and", "langid", "from", "a", "device", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L260-L270
241,314
pyusb/pyusb
usb/legacy.py
DeviceHandle.getDescriptor
def getDescriptor(self, desc_type, desc_index, length, endpoint = -1): r"""Retrieves a descriptor from the device identified by the type and index of the descriptor. Arguments: desc_type: descriptor type. desc_index: index of the descriptor. len: descriptor l...
python
def getDescriptor(self, desc_type, desc_index, length, endpoint = -1): r"""Retrieves a descriptor from the device identified by the type and index of the descriptor. Arguments: desc_type: descriptor type. desc_index: index of the descriptor. len: descriptor l...
[ "def", "getDescriptor", "(", "self", ",", "desc_type", ",", "desc_index", ",", "length", ",", "endpoint", "=", "-", "1", ")", ":", "return", "control", ".", "get_descriptor", "(", "self", ".", "dev", ",", "length", ",", "desc_type", ",", "desc_index", ")...
r"""Retrieves a descriptor from the device identified by the type and index of the descriptor. Arguments: desc_type: descriptor type. desc_index: index of the descriptor. len: descriptor length. endpoint: ignored.
[ "r", "Retrieves", "a", "descriptor", "from", "the", "device", "identified", "by", "the", "type", "and", "index", "of", "the", "descriptor", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L272-L282
241,315
pyusb/pyusb
usb/backend/__init__.py
IBackend.get_endpoint_descriptor
def get_endpoint_descriptor(self, dev, ep, intf, alt, config): r"""Return an endpoint descriptor of the given device. The object returned is required to have all the Endpoint Descriptor fields acessible as member variables. They must be convertible (but not required to be equal) to the ...
python
def get_endpoint_descriptor(self, dev, ep, intf, alt, config): r"""Return an endpoint descriptor of the given device. The object returned is required to have all the Endpoint Descriptor fields acessible as member variables. They must be convertible (but not required to be equal) to the ...
[ "def", "get_endpoint_descriptor", "(", "self", ",", "dev", ",", "ep", ",", "intf", ",", "alt", ",", "config", ")", ":", "_not_implemented", "(", "self", ".", "get_endpoint_descriptor", ")" ]
r"""Return an endpoint descriptor of the given device. The object returned is required to have all the Endpoint Descriptor fields acessible as member variables. They must be convertible (but not required to be equal) to the int type. The ep parameter is the endpoint logical index (not ...
[ "r", "Return", "an", "endpoint", "descriptor", "of", "the", "given", "device", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L140-L151
241,316
pyusb/pyusb
usb/backend/__init__.py
IBackend.bulk_write
def bulk_write(self, dev_handle, ep, intf, data, timeout): r"""Perform a bulk write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of the in...
python
def bulk_write(self, dev_handle, ep, intf, data, timeout): r"""Perform a bulk write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of the in...
[ "def", "bulk_write", "(", "self", ",", "dev_handle", ",", "ep", ",", "intf", ",", "data", ",", "timeout", ")", ":", "_not_implemented", "(", "self", ".", "bulk_write", ")" ]
r"""Perform a bulk write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of the interface containing the endpoint. The data parameter is the ...
[ "r", "Perform", "a", "bulk", "write", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L225-L238
241,317
pyusb/pyusb
usb/backend/__init__.py
IBackend.bulk_read
def bulk_read(self, dev_handle, ep, intf, buff, timeout): r"""Perform a bulk read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field of th...
python
def bulk_read(self, dev_handle, ep, intf, buff, timeout): r"""Perform a bulk read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field of th...
[ "def", "bulk_read", "(", "self", ",", "dev_handle", ",", "ep", ",", "intf", ",", "buff", ",", "timeout", ")", ":", "_not_implemented", "(", "self", ".", "bulk_read", ")" ]
r"""Perform a bulk read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field of the interface containing the endpoint. The buff parameter is...
[ "r", "Perform", "a", "bulk", "read", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L240-L253
241,318
pyusb/pyusb
usb/backend/__init__.py
IBackend.intr_write
def intr_write(self, dev_handle, ep, intf, data, timeout): r"""Perform an interrupt write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of ...
python
def intr_write(self, dev_handle, ep, intf, data, timeout): r"""Perform an interrupt write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of ...
[ "def", "intr_write", "(", "self", ",", "dev_handle", ",", "ep", ",", "intf", ",", "data", ",", "timeout", ")", ":", "_not_implemented", "(", "self", ".", "intr_write", ")" ]
r"""Perform an interrupt write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of the interface containing the endpoint. The data parameter i...
[ "r", "Perform", "an", "interrupt", "write", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L255-L268
241,319
pyusb/pyusb
usb/backend/__init__.py
IBackend.intr_read
def intr_read(self, dev_handle, ep, intf, size, timeout): r"""Perform an interrut read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field ...
python
def intr_read(self, dev_handle, ep, intf, size, timeout): r"""Perform an interrut read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field ...
[ "def", "intr_read", "(", "self", ",", "dev_handle", ",", "ep", ",", "intf", ",", "size", ",", "timeout", ")", ":", "_not_implemented", "(", "self", ".", "intr_read", ")" ]
r"""Perform an interrut read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field of the interface containing the endpoint. The buff parameter ...
[ "r", "Perform", "an", "interrut", "read", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L270-L283
241,320
pyusb/pyusb
usb/backend/__init__.py
IBackend.iso_write
def iso_write(self, dev_handle, ep, intf, data, timeout): r"""Perform an isochronous write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of...
python
def iso_write(self, dev_handle, ep, intf, data, timeout): r"""Perform an isochronous write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of...
[ "def", "iso_write", "(", "self", ",", "dev_handle", ",", "ep", ",", "intf", ",", "data", ",", "timeout", ")", ":", "_not_implemented", "(", "self", ".", "iso_write", ")" ]
r"""Perform an isochronous write. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be sent to. intf is the bInterfaceNumber field of the interface containing the endpoint. The data parameter ...
[ "r", "Perform", "an", "isochronous", "write", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L285-L298
241,321
pyusb/pyusb
usb/backend/__init__.py
IBackend.iso_read
def iso_read(self, dev_handle, ep, intf, size, timeout): r"""Perform an isochronous read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field ...
python
def iso_read(self, dev_handle, ep, intf, size, timeout): r"""Perform an isochronous read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field ...
[ "def", "iso_read", "(", "self", ",", "dev_handle", ",", "ep", ",", "intf", ",", "size", ",", "timeout", ")", ":", "_not_implemented", "(", "self", ".", "iso_read", ")" ]
r"""Perform an isochronous read. dev_handle is the value returned by the open_device() method. The ep parameter is the bEndpointAddress field whose endpoint the data will be received from. intf is the bInterfaceNumber field of the interface containing the endpoint. The buff parameter ...
[ "r", "Perform", "an", "isochronous", "read", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L300-L313
241,322
pyusb/pyusb
usb/backend/__init__.py
IBackend.ctrl_transfer
def ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue, wIndex, data, timeout): r"""Perform a control transfer on the endpoint 0. The di...
python
def ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue, wIndex, data, timeout): r"""Perform a control transfer on the endpoint 0. The di...
[ "def", "ctrl_transfer", "(", "self", ",", "dev_handle", ",", "bmRequestType", ",", "bRequest", ",", "wValue", ",", "wIndex", ",", "data", ",", "timeout", ")", ":", "_not_implemented", "(", "self", ".", "ctrl_transfer", ")" ]
r"""Perform a control transfer on the endpoint 0. The direction of the transfer is inferred from the bmRequestType field of the setup packet. dev_handle is the value returned by the open_device() method. bmRequestType, bRequest, wValue and wIndex are the same fields of the setu...
[ "r", "Perform", "a", "control", "transfer", "on", "the", "endpoint", "0", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/backend/__init__.py#L315-L340
241,323
pyusb/pyusb
usb/util.py
find_descriptor
def find_descriptor(desc, find_all=False, custom_match=None, **args): r"""Find an inner descriptor. find_descriptor works in the same way as the core.find() function does, but it acts on general descriptor objects. For example, suppose you have a Device object called dev and want a Configuration of thi...
python
def find_descriptor(desc, find_all=False, custom_match=None, **args): r"""Find an inner descriptor. find_descriptor works in the same way as the core.find() function does, but it acts on general descriptor objects. For example, suppose you have a Device object called dev and want a Configuration of thi...
[ "def", "find_descriptor", "(", "desc", ",", "find_all", "=", "False", ",", "custom_match", "=", "None", ",", "*", "*", "args", ")", ":", "def", "desc_iter", "(", "*", "*", "kwargs", ")", ":", "for", "d", "in", "desc", ":", "tests", "=", "(", "val",...
r"""Find an inner descriptor. find_descriptor works in the same way as the core.find() function does, but it acts on general descriptor objects. For example, suppose you have a Device object called dev and want a Configuration of this object with its bConfigurationValue equals to 1, the code would ...
[ "r", "Find", "an", "inner", "descriptor", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/util.py#L151-L179
241,324
pyusb/pyusb
usb/util.py
get_langids
def get_langids(dev): r"""Retrieve the list of supported Language IDs from the device. Most client code should not call this function directly, but instead use the langids property on the Device object, which will call this function as needed and cache the result. USB LANGIDs are 16-bit integers f...
python
def get_langids(dev): r"""Retrieve the list of supported Language IDs from the device. Most client code should not call this function directly, but instead use the langids property on the Device object, which will call this function as needed and cache the result. USB LANGIDs are 16-bit integers f...
[ "def", "get_langids", "(", "dev", ")", ":", "from", "usb", ".", "control", "import", "get_descriptor", "buf", "=", "get_descriptor", "(", "dev", ",", "254", ",", "DESC_TYPE_STRING", ",", "0", ")", "# The array is retrieved by asking for string descriptor zero, which i...
r"""Retrieve the list of supported Language IDs from the device. Most client code should not call this function directly, but instead use the langids property on the Device object, which will call this function as needed and cache the result. USB LANGIDs are 16-bit integers familiar to Windows develop...
[ "r", "Retrieve", "the", "list", "of", "supported", "Language", "IDs", "from", "the", "device", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/util.py#L222-L270
241,325
pyusb/pyusb
usb/util.py
get_string
def get_string(dev, index, langid = None): r"""Retrieve a string descriptor from the device. dev is the Device object which the string will be read from. index is the string descriptor index and langid is the Language ID of the descriptor. If langid is omitted, the string descriptor of the first L...
python
def get_string(dev, index, langid = None): r"""Retrieve a string descriptor from the device. dev is the Device object which the string will be read from. index is the string descriptor index and langid is the Language ID of the descriptor. If langid is omitted, the string descriptor of the first L...
[ "def", "get_string", "(", "dev", ",", "index", ",", "langid", "=", "None", ")", ":", "if", "0", "==", "index", ":", "return", "None", "from", "usb", ".", "control", "import", "get_descriptor", "langids", "=", "dev", ".", "langids", "if", "0", "==", "...
r"""Retrieve a string descriptor from the device. dev is the Device object which the string will be read from. index is the string descriptor index and langid is the Language ID of the descriptor. If langid is omitted, the string descriptor of the first Language ID will be returned. Zero is never...
[ "r", "Retrieve", "a", "string", "descriptor", "from", "the", "device", "." ]
ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/util.py#L272-L317
241,326
atztogo/phonopy
phonopy/unfolding/core.py
Unfolding._set_translations
def _set_translations(self): """Set primitive translations in supercell _trans_s Translations with respect to supercell basis vectors _trans_p Translations with respect to primitive cell basis vectors _N Number of the translations = det(supercel_matri...
python
def _set_translations(self): pcell = PhonopyAtoms(numbers=[1], scaled_positions=[[0, 0, 0]], cell=np.diag([1, 1, 1])) smat = self._supercell_matrix self._trans_s = get_supercell(pcell, smat).get_scaled_positions() self._trans_p = ...
[ "def", "_set_translations", "(", "self", ")", ":", "pcell", "=", "PhonopyAtoms", "(", "numbers", "=", "[", "1", "]", ",", "scaled_positions", "=", "[", "[", "0", ",", "0", ",", "0", "]", "]", ",", "cell", "=", "np", ".", "diag", "(", "[", "1", ...
Set primitive translations in supercell _trans_s Translations with respect to supercell basis vectors _trans_p Translations with respect to primitive cell basis vectors _N Number of the translations = det(supercel_matrix)
[ "Set", "primitive", "translations", "in", "supercell" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/unfolding/core.py#L164-L182
241,327
atztogo/phonopy
phonopy/qha/core.py
QHA.run
def run(self, verbose=False): """Fit parameters to EOS at temperatures Even if fitting failed, simply omit the volume point. In this case, the failed temperature point doesn't exist in the returned arrays. """ if verbose: print(("#%11s" + "%14s" * 4) % ("T", "E_0",...
python
def run(self, verbose=False): if verbose: print(("#%11s" + "%14s" * 4) % ("T", "E_0", "B_0", "B'_0", "V_0")) # Plus one temperature point is necessary for computing e.g. beta. num_elems = self._get_num_elems(self._all_temperatures) + 1 if num_elems > len(self._all_temperatur...
[ "def", "run", "(", "self", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "print", "(", "(", "\"#%11s\"", "+", "\"%14s\"", "*", "4", ")", "%", "(", "\"T\"", ",", "\"E_0\"", ",", "\"B_0\"", ",", "\"B'_0\"", ",", "\"V_0\"", ")", ")", ...
Fit parameters to EOS at temperatures Even if fitting failed, simply omit the volume point. In this case, the failed temperature point doesn't exist in the returned arrays.
[ "Fit", "parameters", "to", "EOS", "at", "temperatures" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/qha/core.py#L144-L211
241,328
atztogo/phonopy
phonopy/structure/cells.py
_trim_cell
def _trim_cell(relative_axes, cell, symprec): """Trim overlapping atoms Parameters ---------- relative_axes: ndarray Transformation matrix to transform supercell to a smaller cell such as: trimmed_lattice = np.dot(relative_axes.T, cell.get_cell()) shape=(3,3) cell: Phono...
python
def _trim_cell(relative_axes, cell, symprec): positions = cell.get_scaled_positions() numbers = cell.get_atomic_numbers() masses = cell.get_masses() magmoms = cell.get_magnetic_moments() lattice = cell.get_cell() trimmed_lattice = np.dot(relative_axes.T, lattice) trimmed_positions = [] ...
[ "def", "_trim_cell", "(", "relative_axes", ",", "cell", ",", "symprec", ")", ":", "positions", "=", "cell", ".", "get_scaled_positions", "(", ")", "numbers", "=", "cell", ".", "get_atomic_numbers", "(", ")", "masses", "=", "cell", ".", "get_masses", "(", "...
Trim overlapping atoms Parameters ---------- relative_axes: ndarray Transformation matrix to transform supercell to a smaller cell such as: trimmed_lattice = np.dot(relative_axes.T, cell.get_cell()) shape=(3,3) cell: PhonopyAtoms A supercell symprec: float ...
[ "Trim", "overlapping", "atoms" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L459-L543
241,329
atztogo/phonopy
phonopy/structure/cells.py
get_reduced_bases
def get_reduced_bases(lattice, method='delaunay', tolerance=1e-5): """Search kinds of shortest basis vectors Parameters ---------- lattice : ndarray or list of list Basis vectors by row vectors, [a, b, c]^T shape=(3, 3) method : str ...
python
def get_reduced_bases(lattice, method='delaunay', tolerance=1e-5): if method == 'niggli': return spg.niggli_reduce(lattice, eps=tolerance) else: return spg.delaunay_reduce(lattice, eps=tolerance)
[ "def", "get_reduced_bases", "(", "lattice", ",", "method", "=", "'delaunay'", ",", "tolerance", "=", "1e-5", ")", ":", "if", "method", "==", "'niggli'", ":", "return", "spg", ".", "niggli_reduce", "(", "lattice", ",", "eps", "=", "tolerance", ")", "else", ...
Search kinds of shortest basis vectors Parameters ---------- lattice : ndarray or list of list Basis vectors by row vectors, [a, b, c]^T shape=(3, 3) method : str delaunay: Delaunay reduction niggli: Niggli reduction tolerance : float Tolerance to find shorte...
[ "Search", "kinds", "of", "shortest", "basis", "vectors" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L549-L577
241,330
atztogo/phonopy
phonopy/structure/cells.py
get_smallest_vectors
def get_smallest_vectors(supercell_bases, supercell_pos, primitive_pos, symprec=1e-5): """Find shortest atomic pair vectors Note ---- Shortest vectors from an atom in primitive cell to an atom in supercell in the fractional ...
python
def get_smallest_vectors(supercell_bases, supercell_pos, primitive_pos, symprec=1e-5): reduced_bases = get_reduced_bases(supercell_bases, method='delaunay', toleranc...
[ "def", "get_smallest_vectors", "(", "supercell_bases", ",", "supercell_pos", ",", "primitive_pos", ",", "symprec", "=", "1e-5", ")", ":", "reduced_bases", "=", "get_reduced_bases", "(", "supercell_bases", ",", "method", "=", "'delaunay'", ",", "tolerance", "=", "s...
Find shortest atomic pair vectors Note ---- Shortest vectors from an atom in primitive cell to an atom in supercell in the fractional coordinates of primitive cell. If an atom in supercell is on the border centered at an atom in primitive and there are multiple vectors that have the same di...
[ "Find", "shortest", "atomic", "pair", "vectors" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L595-L741
241,331
atztogo/phonopy
phonopy/structure/cells.py
compute_all_sg_permutations
def compute_all_sg_permutations(positions, # scaled positions rotations, # scaled translations, # scaled lattice, # column vectors symprec): """Compute a permutation for every space gr...
python
def compute_all_sg_permutations(positions, # scaled positions rotations, # scaled translations, # scaled lattice, # column vectors symprec): out = [] # Finally the shape is fixed as (...
[ "def", "compute_all_sg_permutations", "(", "positions", ",", "# scaled positions", "rotations", ",", "# scaled", "translations", ",", "# scaled", "lattice", ",", "# column vectors", "symprec", ")", ":", "out", "=", "[", "]", "# Finally the shape is fixed as (num_sym, num_...
Compute a permutation for every space group operation. See 'compute_permutation_for_rotation' for more info. Output has shape (num_rot, num_pos)
[ "Compute", "a", "permutation", "for", "every", "space", "group", "operation", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L744-L764
241,332
atztogo/phonopy
phonopy/structure/cells.py
compute_permutation_for_rotation
def compute_permutation_for_rotation(positions_a, # scaled positions positions_b, lattice, # column vectors symprec): """Get the overall permutation such that positions_a[perm[i]] == positions_b...
python
def compute_permutation_for_rotation(positions_a, # scaled positions positions_b, lattice, # column vectors symprec): # Sort both sides by some measure which is likely to produce a small # maximum va...
[ "def", "compute_permutation_for_rotation", "(", "positions_a", ",", "# scaled positions", "positions_b", ",", "lattice", ",", "# column vectors", "symprec", ")", ":", "# Sort both sides by some measure which is likely to produce a small", "# maximum value of (sorted_rotated_index - sor...
Get the overall permutation such that positions_a[perm[i]] == positions_b[i] (modulo the lattice) or in numpy speak, positions_a[perm] == positions_b (modulo the lattice) This version is optimized for the case where positions_a and positions_b are related by a rotation.
[ "Get", "the", "overall", "permutation", "such", "that" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L767-L811
241,333
atztogo/phonopy
phonopy/structure/cells.py
_compute_permutation_c
def _compute_permutation_c(positions_a, # scaled positions positions_b, lattice, # column vectors symprec): """Version of '_compute_permutation_for_rotation' which just directly calls the C function, without any conditioning of t...
python
def _compute_permutation_c(positions_a, # scaled positions positions_b, lattice, # column vectors symprec): permutation = np.zeros(shape=(len(positions_a),), dtype='intc') def permutation_error(): raise ValueError("Input...
[ "def", "_compute_permutation_c", "(", "positions_a", ",", "# scaled positions", "positions_b", ",", "lattice", ",", "# column vectors", "symprec", ")", ":", "permutation", "=", "np", ".", "zeros", "(", "shape", "=", "(", "len", "(", "positions_a", ")", ",", ")...
Version of '_compute_permutation_for_rotation' which just directly calls the C function, without any conditioning of the data. Skipping the conditioning step makes this EXTREMELY slow on large structures.
[ "Version", "of", "_compute_permutation_for_rotation", "which", "just", "directly", "calls", "the", "C", "function", "without", "any", "conditioning", "of", "the", "data", ".", "Skipping", "the", "conditioning", "step", "makes", "this", "EXTREMELY", "slow", "on", "...
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L814-L858
241,334
atztogo/phonopy
phonopy/structure/cells.py
estimate_supercell_matrix
def estimate_supercell_matrix(spglib_dataset, max_num_atoms=120): """Estimate supercell matrix from conventional cell Diagonal supercell matrix is estimated from basis vector lengths and maximum number of atoms to be accepted. Supercell is assumed to be made from the stand...
python
def estimate_supercell_matrix(spglib_dataset, max_num_atoms=120): spg_num = spglib_dataset['number'] num_atoms = len(spglib_dataset['std_types']) lengths = _get_lattice_parameters(spglib_dataset['std_lattice']) if spg_num <= 74: # Triclinic, monoclinic, and orthorhombic ...
[ "def", "estimate_supercell_matrix", "(", "spglib_dataset", ",", "max_num_atoms", "=", "120", ")", ":", "spg_num", "=", "spglib_dataset", "[", "'number'", "]", "num_atoms", "=", "len", "(", "spglib_dataset", "[", "'std_types'", "]", ")", "lengths", "=", "_get_lat...
Estimate supercell matrix from conventional cell Diagonal supercell matrix is estimated from basis vector lengths and maximum number of atoms to be accepted. Supercell is assumed to be made from the standardized cell and to be closest to sphere under keeping lattice symmetry. For triclinic, monoclinic,...
[ "Estimate", "supercell", "matrix", "from", "conventional", "cell" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L1208-L1246
241,335
atztogo/phonopy
phonopy/structure/cells.py
_get_lattice_parameters
def _get_lattice_parameters(lattice): """Return basis vector lengths Parameters ---------- lattice : array_like Basis vectors given as column vectors shape=(3, 3), dtype='double' Returns ------- ndarray, shape=(3,), dtype='double' """ return np.array(np.sqrt(np.do...
python
def _get_lattice_parameters(lattice): return np.array(np.sqrt(np.dot(lattice.T, lattice).diagonal()), dtype='double')
[ "def", "_get_lattice_parameters", "(", "lattice", ")", ":", "return", "np", ".", "array", "(", "np", ".", "sqrt", "(", "np", ".", "dot", "(", "lattice", ".", "T", ",", "lattice", ")", ".", "diagonal", "(", ")", ")", ",", "dtype", "=", "'double'", "...
Return basis vector lengths Parameters ---------- lattice : array_like Basis vectors given as column vectors shape=(3, 3), dtype='double' Returns ------- ndarray, shape=(3,), dtype='double'
[ "Return", "basis", "vector", "lengths" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L1249-L1265
241,336
atztogo/phonopy
phonopy/structure/cells.py
SNF3x3._second
def _second(self): """Find Smith normal form for Right-low 2x2 matrix""" self._second_one_loop() A = self._A if A[2, 1] == 0: return True elif A[2, 1] % A[1, 1] == 0: self._second_finalize() self._Ps += self._L self._L = [] ...
python
def _second(self): self._second_one_loop() A = self._A if A[2, 1] == 0: return True elif A[2, 1] % A[1, 1] == 0: self._second_finalize() self._Ps += self._L self._L = [] return True else: return False
[ "def", "_second", "(", "self", ")", ":", "self", ".", "_second_one_loop", "(", ")", "A", "=", "self", ".", "_A", "if", "A", "[", "2", ",", "1", "]", "==", "0", ":", "return", "True", "elif", "A", "[", "2", ",", "1", "]", "%", "A", "[", "1",...
Find Smith normal form for Right-low 2x2 matrix
[ "Find", "Smith", "normal", "form", "for", "Right", "-", "low", "2x2", "matrix" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L1030-L1043
241,337
atztogo/phonopy
phonopy/structure/cells.py
SNF3x3._second_column
def _second_column(self): """Right-low 2x2 matrix Assume elements in first row and column are all zero except for A[0,0]. """ if self._A[1, 1] == 0 and self._A[2, 1] != 0: self._swap_rows(1, 2) if self._A[2, 1] != 0: self._zero_second_column()
python
def _second_column(self): if self._A[1, 1] == 0 and self._A[2, 1] != 0: self._swap_rows(1, 2) if self._A[2, 1] != 0: self._zero_second_column()
[ "def", "_second_column", "(", "self", ")", ":", "if", "self", ".", "_A", "[", "1", ",", "1", "]", "==", "0", "and", "self", ".", "_A", "[", "2", ",", "1", "]", "!=", "0", ":", "self", ".", "_swap_rows", "(", "1", ",", "2", ")", "if", "self"...
Right-low 2x2 matrix Assume elements in first row and column are all zero except for A[0,0].
[ "Right", "-", "low", "2x2", "matrix" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L1055-L1066
241,338
atztogo/phonopy
phonopy/structure/cells.py
SNF3x3._swap_rows
def _swap_rows(self, i, j): """Swap i and j rows As the side effect, determinant flips. """ L = np.eye(3, dtype='intc') L[i, i] = 0 L[j, j] = 0 L[i, j] = 1 L[j, i] = 1 self._L.append(L.copy()) self._A = np.dot(L, self._A)
python
def _swap_rows(self, i, j): L = np.eye(3, dtype='intc') L[i, i] = 0 L[j, j] = 0 L[i, j] = 1 L[j, i] = 1 self._L.append(L.copy()) self._A = np.dot(L, self._A)
[ "def", "_swap_rows", "(", "self", ",", "i", ",", "j", ")", ":", "L", "=", "np", ".", "eye", "(", "3", ",", "dtype", "=", "'intc'", ")", "L", "[", "i", ",", "i", "]", "=", "0", "L", "[", "j", ",", "j", "]", "=", "0", "L", "[", "i", ","...
Swap i and j rows As the side effect, determinant flips.
[ "Swap", "i", "and", "j", "rows" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L1088-L1101
241,339
atztogo/phonopy
phonopy/structure/cells.py
SNF3x3._flip_sign_row
def _flip_sign_row(self, i): """Multiply -1 for all elements in row""" L = np.eye(3, dtype='intc') L[i, i] = -1 self._L.append(L.copy()) self._A = np.dot(L, self._A)
python
def _flip_sign_row(self, i): L = np.eye(3, dtype='intc') L[i, i] = -1 self._L.append(L.copy()) self._A = np.dot(L, self._A)
[ "def", "_flip_sign_row", "(", "self", ",", "i", ")", ":", "L", "=", "np", ".", "eye", "(", "3", ",", "dtype", "=", "'intc'", ")", "L", "[", "i", ",", "i", "]", "=", "-", "1", "self", ".", "_L", ".", "append", "(", "L", ".", "copy", "(", "...
Multiply -1 for all elements in row
[ "Multiply", "-", "1", "for", "all", "elements", "in", "row" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/cells.py#L1103-L1109
241,340
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.dataset
def dataset(self, dataset): """Set dataset having displacements and optionally forces Note ---- Elements of the list accessed by 'first_atoms' corresponds to each displaced supercell. Each displaced supercell contains only one displacement. dict['first_atoms']['forces'] ...
python
def dataset(self, dataset): if 'displacements' in dataset: natom = self._supercell.get_number_of_atoms() if type(dataset['displacements']) is np.ndarray: if dataset['displacements'].ndim in (1, 2): d = dataset['displacements'].reshape((-1, natom, 3)) ...
[ "def", "dataset", "(", "self", ",", "dataset", ")", ":", "if", "'displacements'", "in", "dataset", ":", "natom", "=", "self", ".", "_supercell", ".", "get_number_of_atoms", "(", ")", "if", "type", "(", "dataset", "[", "'displacements'", "]", ")", "is", "...
Set dataset having displacements and optionally forces Note ---- Elements of the list accessed by 'first_atoms' corresponds to each displaced supercell. Each displaced supercell contains only one displacement. dict['first_atoms']['forces'] gives atomic forces in each dis...
[ "Set", "dataset", "having", "displacements", "and", "optionally", "forces" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L448-L492
241,341
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.forces
def forces(self, sets_of_forces): """Set forces in displacement dataset. Parameters ---------- sets_of_forces : array_like A set of atomic forces in displaced supercells. The order of displaced supercells has to match with that in displacement dataset...
python
def forces(self, sets_of_forces): if 'first_atoms' in self._displacement_dataset: for disp, forces in zip(self._displacement_dataset['first_atoms'], sets_of_forces): disp['forces'] = forces elif 'forces' in self._displacement_dataset: ...
[ "def", "forces", "(", "self", ",", "sets_of_forces", ")", ":", "if", "'first_atoms'", "in", "self", ".", "_displacement_dataset", ":", "for", "disp", ",", "forces", "in", "zip", "(", "self", ".", "_displacement_dataset", "[", "'first_atoms'", "]", ",", "sets...
Set forces in displacement dataset. Parameters ---------- sets_of_forces : array_like A set of atomic forces in displaced supercells. The order of displaced supercells has to match with that in displacement dataset. shape=(displaced supercells, at...
[ "Set", "forces", "in", "displacement", "dataset", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L498-L522
241,342
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.force_constants
def force_constants(self, force_constants): """Set force constants Parameters ---------- force_constants : array_like Force constants matrix. If this is given in own condiguous ndarray with order='C' and dtype='double', internal copy of data is avoide...
python
def force_constants(self, force_constants): if type(force_constants) is np.ndarray: fc_shape = force_constants.shape if fc_shape[0] != fc_shape[1]: if self._primitive.get_number_of_atoms() != fc_shape[0]: msg = ("Force constants shape disagrees with cr...
[ "def", "force_constants", "(", "self", ",", "force_constants", ")", ":", "if", "type", "(", "force_constants", ")", "is", "np", ".", "ndarray", ":", "fc_shape", "=", "force_constants", ".", "shape", "if", "fc_shape", "[", "0", "]", "!=", "fc_shape", "[", ...
Set force constants Parameters ---------- force_constants : array_like Force constants matrix. If this is given in own condiguous ndarray with order='C' and dtype='double', internal copy of data is avoided. Therefore some computational resources are saved. ...
[ "Set", "force", "constants" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L528-L553
241,343
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.generate_displacements
def generate_displacements(self, distance=0.01, is_plusminus='auto', is_diagonal=True, is_trigonal=False): """Generate displacement dataset""" displacement_directions = get_least_d...
python
def generate_displacements(self, distance=0.01, is_plusminus='auto', is_diagonal=True, is_trigonal=False): displacement_directions = get_least_displacements( self._symmetry, ...
[ "def", "generate_displacements", "(", "self", ",", "distance", "=", "0.01", ",", "is_plusminus", "=", "'auto'", ",", "is_diagonal", "=", "True", ",", "is_trigonal", "=", "False", ")", ":", "displacement_directions", "=", "get_least_displacements", "(", "self", "...
Generate displacement dataset
[ "Generate", "displacement", "dataset" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L570-L586
241,344
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.get_dynamical_matrix_at_q
def get_dynamical_matrix_at_q(self, q): """Calculate dynamical matrix at a given q-point Parameters ---------- q: array_like A q-vector. shape=(3,), dtype='double' Returns ------- dynamical_matrix: ndarray Dynamical matrix. ...
python
def get_dynamical_matrix_at_q(self, q): self._set_dynamical_matrix() if self._dynamical_matrix is None: msg = ("Dynamical matrix has not yet built.") raise RuntimeError(msg) self._dynamical_matrix.set_dynamical_matrix(q) return self._dynamical_matrix.get_dynamica...
[ "def", "get_dynamical_matrix_at_q", "(", "self", ",", "q", ")", ":", "self", ".", "_set_dynamical_matrix", "(", ")", "if", "self", ".", "_dynamical_matrix", "is", "None", ":", "msg", "=", "(", "\"Dynamical matrix has not yet built.\"", ")", "raise", "RuntimeError"...
Calculate dynamical matrix at a given q-point Parameters ---------- q: array_like A q-vector. shape=(3,), dtype='double' Returns ------- dynamical_matrix: ndarray Dynamical matrix. shape=(bands, bands), dtype='complex'
[ "Calculate", "dynamical", "matrix", "at", "a", "given", "q", "-", "point" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L652-L675
241,345
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.get_frequencies
def get_frequencies(self, q): """Calculate phonon frequencies at a given q-point Parameters ---------- q: array_like A q-vector. shape=(3,), dtype='double' Returns ------- frequencies: ndarray Phonon frequencies. s...
python
def get_frequencies(self, q): self._set_dynamical_matrix() if self._dynamical_matrix is None: msg = ("Dynamical matrix has not yet built.") raise RuntimeError(msg) self._dynamical_matrix.set_dynamical_matrix(q) dm = self._dynamical_matrix.get_dynamical_matrix() ...
[ "def", "get_frequencies", "(", "self", ",", "q", ")", ":", "self", ".", "_set_dynamical_matrix", "(", ")", "if", "self", ".", "_dynamical_matrix", "is", "None", ":", "msg", "=", "(", "\"Dynamical matrix has not yet built.\"", ")", "raise", "RuntimeError", "(", ...
Calculate phonon frequencies at a given q-point Parameters ---------- q: array_like A q-vector. shape=(3,), dtype='double' Returns ------- frequencies: ndarray Phonon frequencies. shape=(bands, ), dtype='double'
[ "Calculate", "phonon", "frequencies", "at", "a", "given", "q", "-", "point" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L677-L707
241,346
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.get_frequencies_with_eigenvectors
def get_frequencies_with_eigenvectors(self, q): """Calculate phonon frequencies and eigenvectors at a given q-point Parameters ---------- q: array_like A q-vector. shape=(3,) Returns ------- (frequencies, eigenvectors) frequencie...
python
def get_frequencies_with_eigenvectors(self, q): self._set_dynamical_matrix() if self._dynamical_matrix is None: msg = ("Dynamical matrix has not yet built.") raise RuntimeError(msg) self._dynamical_matrix.set_dynamical_matrix(q) dm = self._dynamical_matrix.get_dy...
[ "def", "get_frequencies_with_eigenvectors", "(", "self", ",", "q", ")", ":", "self", ".", "_set_dynamical_matrix", "(", ")", "if", "self", ".", "_dynamical_matrix", "is", "None", ":", "msg", "=", "(", "\"Dynamical matrix has not yet built.\"", ")", "raise", "Runti...
Calculate phonon frequencies and eigenvectors at a given q-point Parameters ---------- q: array_like A q-vector. shape=(3,) Returns ------- (frequencies, eigenvectors) frequencies: ndarray Phonon frequencies shape...
[ "Calculate", "phonon", "frequencies", "and", "eigenvectors", "at", "a", "given", "q", "-", "point" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L709-L746
241,347
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_band_structure
def run_band_structure(self, paths, with_eigenvectors=False, with_group_velocities=False, is_band_connection=False, path_connections=None, labels=None, ...
python
def run_band_structure(self, paths, with_eigenvectors=False, with_group_velocities=False, is_band_connection=False, path_connections=None, labels=None, ...
[ "def", "run_band_structure", "(", "self", ",", "paths", ",", "with_eigenvectors", "=", "False", ",", "with_group_velocities", "=", "False", ",", "is_band_connection", "=", "False", ",", "path_connections", "=", "None", ",", "labels", "=", "None", ",", "is_legacy...
Run phonon band structure calculation. Parameters ---------- paths : List of array_like Sets of qpoints that can be passed to phonopy.set_band_structure(). Numbers of qpoints can be different. shape of each array_like : (qpoints, 3) with_eigenvectors ...
[ "Run", "phonon", "band", "structure", "calculation", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L749-L808
241,348
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.init_mesh
def init_mesh(self, mesh=100.0, shift=None, is_time_reversal=True, is_mesh_symmetry=True, with_eigenvectors=False, with_group_velocities=False, is_gamma_center=False, use_iter_...
python
def init_mesh(self, mesh=100.0, shift=None, is_time_reversal=True, is_mesh_symmetry=True, with_eigenvectors=False, with_group_velocities=False, is_gamma_center=False, use_iter_...
[ "def", "init_mesh", "(", "self", ",", "mesh", "=", "100.0", ",", "shift", "=", "None", ",", "is_time_reversal", "=", "True", ",", "is_mesh_symmetry", "=", "True", ",", "with_eigenvectors", "=", "False", ",", "with_group_velocities", "=", "False", ",", "is_ga...
Initialize mesh sampling phonon calculation without starting to run. Phonon calculation starts explicitly with calling Mesh.run() or implicitly with accessing getters of Mesh instance, e.g., Mesh.frequencies. Parameters ---------- mesh: array_like or float, optional ...
[ "Initialize", "mesh", "sampling", "phonon", "calculation", "without", "starting", "to", "run", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L974-L1082
241,349
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_mesh
def run_mesh(self, mesh=100.0, shift=None, is_time_reversal=True, is_mesh_symmetry=True, with_eigenvectors=False, with_group_velocities=False, is_gamma_center=False): """Run mesh sampling phono...
python
def run_mesh(self, mesh=100.0, shift=None, is_time_reversal=True, is_mesh_symmetry=True, with_eigenvectors=False, with_group_velocities=False, is_gamma_center=False): self.init_mesh(mesh=mesh, ...
[ "def", "run_mesh", "(", "self", ",", "mesh", "=", "100.0", ",", "shift", "=", "None", ",", "is_time_reversal", "=", "True", ",", "is_mesh_symmetry", "=", "True", ",", "with_eigenvectors", "=", "False", ",", "with_group_velocities", "=", "False", ",", "is_gam...
Run mesh sampling phonon calculation. See the parameter details in Phonopy.init_mesh().
[ "Run", "mesh", "sampling", "phonon", "calculation", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1084-L1105
241,350
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.set_mesh
def set_mesh(self, mesh, shift=None, is_time_reversal=True, is_mesh_symmetry=True, is_eigenvectors=False, is_gamma_center=False, run_immediately=True): """Phonon calculations on sampling mesh g...
python
def set_mesh(self, mesh, shift=None, is_time_reversal=True, is_mesh_symmetry=True, is_eigenvectors=False, is_gamma_center=False, run_immediately=True): warnings.warn("Phonopy.set_mesh is deprec...
[ "def", "set_mesh", "(", "self", ",", "mesh", ",", "shift", "=", "None", ",", "is_time_reversal", "=", "True", ",", "is_mesh_symmetry", "=", "True", ",", "is_eigenvectors", "=", "False", ",", "is_gamma_center", "=", "False", ",", "run_immediately", "=", "True...
Phonon calculations on sampling mesh grids Parameters ---------- mesh: array_like Mesh numbers along a, b, c axes. dtype='intc' shape=(3,) shift: array_like, optional, default None (no shift) Mesh shifts along a*, b*, c* axes with respect ...
[ "Phonon", "calculations", "on", "sampling", "mesh", "grids" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1107-L1168
241,351
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.get_mesh_dict
def get_mesh_dict(self): """Returns calculated mesh sampling phonons Returns ------- dict keys: qpoints, weights, frequencies, eigenvectors, and group_velocities Each value for the corresponding key is explained as below. qpoints: ...
python
def get_mesh_dict(self): if self._mesh is None: msg = ("run_mesh has to be done.") raise RuntimeError(msg) retdict = {'qpoints': self._mesh.qpoints, 'weights': self._mesh.weights, 'frequencies': self._mesh.frequencies, 'ei...
[ "def", "get_mesh_dict", "(", "self", ")", ":", "if", "self", ".", "_mesh", "is", "None", ":", "msg", "=", "(", "\"run_mesh has to be done.\"", ")", "raise", "RuntimeError", "(", "msg", ")", "retdict", "=", "{", "'qpoints'", ":", "self", ".", "_mesh", "."...
Returns calculated mesh sampling phonons Returns ------- dict keys: qpoints, weights, frequencies, eigenvectors, and group_velocities Each value for the corresponding key is explained as below. qpoints: ndarray q-points in ...
[ "Returns", "calculated", "mesh", "sampling", "phonons" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1170-L1216
241,352
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.set_iter_mesh
def set_iter_mesh(self, mesh, shift=None, is_time_reversal=True, is_mesh_symmetry=True, is_eigenvectors=False, is_gamma_center=False): """Create an IterMesh instancer Attr...
python
def set_iter_mesh(self, mesh, shift=None, is_time_reversal=True, is_mesh_symmetry=True, is_eigenvectors=False, is_gamma_center=False): warnings.warn("Phonopy.set_iter_mesh is depre...
[ "def", "set_iter_mesh", "(", "self", ",", "mesh", ",", "shift", "=", "None", ",", "is_time_reversal", "=", "True", ",", "is_mesh_symmetry", "=", "True", ",", "is_eigenvectors", "=", "False", ",", "is_gamma_center", "=", "False", ")", ":", "warnings", ".", ...
Create an IterMesh instancer Attributes ---------- See set_mesh method.
[ "Create", "an", "IterMesh", "instancer" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1252-L1277
241,353
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_qpoints
def run_qpoints(self, q_points, with_eigenvectors=False, with_group_velocities=False, with_dynamical_matrices=False, nac_q_direction=None): """Phonon calculations on q-points. Parameters --------...
python
def run_qpoints(self, q_points, with_eigenvectors=False, with_group_velocities=False, with_dynamical_matrices=False, nac_q_direction=None): if self._dynamical_matrix is None: msg = ("Dynamical matrix ...
[ "def", "run_qpoints", "(", "self", ",", "q_points", ",", "with_eigenvectors", "=", "False", ",", "with_group_velocities", "=", "False", ",", "with_dynamical_matrices", "=", "False", ",", "nac_q_direction", "=", "None", ")", ":", "if", "self", ".", "_dynamical_ma...
Phonon calculations on q-points. Parameters ---------- q_points: array_like or float, optional q-points in reduced coordinates. dtype='double', shape=(q-points, 3) with_eigenvectors: bool, optional Eigenvectors are stored by setting True. Default Fals...
[ "Phonon", "calculations", "on", "q", "-", "points", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1349-L1394
241,354
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_total_dos
def run_total_dos(self, sigma=None, freq_min=None, freq_max=None, freq_pitch=None, use_tetrahedron_method=True): """Calculate total DOS from phonons on sampling mesh. Parameters -------...
python
def run_total_dos(self, sigma=None, freq_min=None, freq_max=None, freq_pitch=None, use_tetrahedron_method=True): if self._mesh is None: msg = "run_mesh has to be done before DOS calculation....
[ "def", "run_total_dos", "(", "self", ",", "sigma", "=", "None", ",", "freq_min", "=", "None", ",", "freq_max", "=", "None", ",", "freq_pitch", "=", "None", ",", "use_tetrahedron_method", "=", "True", ")", ":", "if", "self", ".", "_mesh", "is", "None", ...
Calculate total DOS from phonons on sampling mesh. Parameters ---------- sigma : float, optional Smearing width for smearing method. Default is None freq_min, freq_max, freq_pitch : float, optional Minimum and maximum frequencies in which range DOS is computed ...
[ "Calculate", "total", "DOS", "from", "phonons", "on", "sampling", "mesh", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1436-L1466
241,355
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.get_total_DOS
def get_total_DOS(self): """Return frequency points and total DOS as a tuple. Returns ------- A tuple with (frequency_points, total_dos). frequency_points: ndarray shape=(frequency_sampling_points, ), dtype='double' total_dos: shape=(frequency_sa...
python
def get_total_DOS(self): warnings.warn("Phonopy.get_total_DOS is deprecated. " "Use Phonopy.get_total_dos_dict.", DeprecationWarning) dos = self.get_total_dos_dict() return dos['frequency_points'], dos['total_dos']
[ "def", "get_total_DOS", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"Phonopy.get_total_DOS is deprecated. \"", "\"Use Phonopy.get_total_dos_dict.\"", ",", "DeprecationWarning", ")", "dos", "=", "self", ".", "get_total_dos_dict", "(", ")", "return", "dos", "...
Return frequency points and total DOS as a tuple. Returns ------- A tuple with (frequency_points, total_dos). frequency_points: ndarray shape=(frequency_sampling_points, ), dtype='double' total_dos: shape=(frequency_sampling_points, ), dtype='double'
[ "Return", "frequency", "points", "and", "total", "DOS", "as", "a", "tuple", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1519-L1538
241,356
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_projected_dos
def run_projected_dos(self, sigma=None, freq_min=None, freq_max=None, freq_pitch=None, use_tetrahedron_method=True, direction=None, xyz_pr...
python
def run_projected_dos(self, sigma=None, freq_min=None, freq_max=None, freq_pitch=None, use_tetrahedron_method=True, direction=None, xyz_pr...
[ "def", "run_projected_dos", "(", "self", ",", "sigma", "=", "None", ",", "freq_min", "=", "None", ",", "freq_max", "=", "None", ",", "freq_pitch", "=", "None", ",", "use_tetrahedron_method", "=", "True", ",", "direction", "=", "None", ",", "xyz_projection", ...
Calculate projected DOS from phonons on sampling mesh. Parameters ---------- sigma : float, optional Smearing width for smearing method. Default is None freq_min, freq_max, freq_pitch : float, optional Minimum and maximum frequencies in which range DOS is compute...
[ "Calculate", "projected", "DOS", "from", "phonons", "on", "sampling", "mesh", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1578-L1633
241,357
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.get_partial_DOS
def get_partial_DOS(self): """Return frequency points and partial DOS as a tuple. Projection is done to atoms and may be also done along directions depending on the parameters at run_partial_dos. Returns ------- A tuple with (frequency_points, partial_dos). fre...
python
def get_partial_DOS(self): warnings.warn("Phonopy.get_partial_DOS is deprecated. " "Use Phonopy.get_projected_dos_dict.", DeprecationWarning) pdos = self.get_projected_dos_dict() return pdos['frequency_points'], pdos['projected_dos']
[ "def", "get_partial_DOS", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"Phonopy.get_partial_DOS is deprecated. \"", "\"Use Phonopy.get_projected_dos_dict.\"", ",", "DeprecationWarning", ")", "pdos", "=", "self", ".", "get_projected_dos_dict", "(", ")", "return",...
Return frequency points and partial DOS as a tuple. Projection is done to atoms and may be also done along directions depending on the parameters at run_partial_dos. Returns ------- A tuple with (frequency_points, partial_dos). frequency_points: ndarray sha...
[ "Return", "frequency", "points", "and", "partial", "DOS", "as", "a", "tuple", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1695-L1717
241,358
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.plot_projected_dos
def plot_projected_dos(self, pdos_indices=None, legend=None): """Plot projected DOS Parameters ---------- pdos_indices : list of list, optional Sets of indices of atoms whose projected DOS are summed over. The indices start with 0. An example is as follwos: ...
python
def plot_projected_dos(self, pdos_indices=None, legend=None): import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.xaxis.set_ticks_position('both') ax.yaxis.set_ticks_position('both') ax.xaxis.set_tick_params(which='both', direction='in') ax.yaxis.set_tick_params(...
[ "def", "plot_projected_dos", "(", "self", ",", "pdos_indices", "=", "None", ",", "legend", "=", "None", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "fig", ",", "ax", "=", "plt", ".", "subplots", "(", ")", "ax", ".", "xaxis", ".", "s...
Plot projected DOS Parameters ---------- pdos_indices : list of list, optional Sets of indices of atoms whose projected DOS are summed over. The indices start with 0. An example is as follwos: pdos_indices=[[0, 1], [2, 3, 4, 5]] Default is No...
[ "Plot", "projected", "DOS" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1727-L1760
241,359
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_thermal_properties
def run_thermal_properties(self, t_min=0, t_max=1000, t_step=10, temperatures=None, is_projection=False, band_indices=None, ...
python
def run_thermal_properties(self, t_min=0, t_max=1000, t_step=10, temperatures=None, is_projection=False, band_indices=None, ...
[ "def", "run_thermal_properties", "(", "self", ",", "t_min", "=", "0", ",", "t_max", "=", "1000", ",", "t_step", "=", "10", ",", "temperatures", "=", "None", ",", "is_projection", "=", "False", ",", "band_indices", "=", "None", ",", "cutoff_frequency", "=",...
Calculate thermal properties at constant volume Parameters ---------- t_min, t_max, t_step : float, optional Minimum and maximum temperatures and the interval in this temperature range. Default values are 0, 1000, and 10. temperatures : array_like, optional ...
[ "Calculate", "thermal", "properties", "at", "constant", "volume" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1772-L1810
241,360
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.get_thermal_properties
def get_thermal_properties(self): """Return thermal properties Returns ------- (temperatures, free energy, entropy, heat capacity) """ warnings.warn("Phonopy.get_thermal_properties is deprecated. " "Use Phonopy.get_thermal_properties_dict.", ...
python
def get_thermal_properties(self): warnings.warn("Phonopy.get_thermal_properties is deprecated. " "Use Phonopy.get_thermal_properties_dict.", DeprecationWarning) tp = self.get_thermal_properties_dict() return (tp['temperatures'], tp['fr...
[ "def", "get_thermal_properties", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"Phonopy.get_thermal_properties is deprecated. \"", "\"Use Phonopy.get_thermal_properties_dict.\"", ",", "DeprecationWarning", ")", "tp", "=", "self", ".", "get_thermal_properties_dict", "...
Return thermal properties Returns ------- (temperatures, free energy, entropy, heat capacity)
[ "Return", "thermal", "properties" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1856-L1872
241,361
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_thermal_displacements
def run_thermal_displacements(self, t_min=0, t_max=1000, t_step=10, temperatures=None, direction=None, freq_min=None...
python
def run_thermal_displacements(self, t_min=0, t_max=1000, t_step=10, temperatures=None, direction=None, freq_min=None...
[ "def", "run_thermal_displacements", "(", "self", ",", "t_min", "=", "0", ",", "t_max", "=", "1000", ",", "t_step", "=", "10", ",", "temperatures", "=", "None", ",", "direction", "=", "None", ",", "freq_min", "=", "None", ",", "freq_max", "=", "None", "...
Prepare thermal displacements calculation Parameters ---------- t_min, t_max, t_step : float, optional Minimum and maximum temperatures and the interval in this temperature range. Default valuues are 0, 1000, and 10. temperatures : array_like, optional ...
[ "Prepare", "thermal", "displacements", "calculation" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1897-L1959
241,362
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_thermal_displacement_matrices
def run_thermal_displacement_matrices(self, t_min=0, t_max=1000, t_step=10, temperatures=None, freq_min=None, ...
python
def run_thermal_displacement_matrices(self, t_min=0, t_max=1000, t_step=10, temperatures=None, freq_min=None, ...
[ "def", "run_thermal_displacement_matrices", "(", "self", ",", "t_min", "=", "0", ",", "t_max", "=", "1000", ",", "t_step", "=", "10", ",", "temperatures", "=", "None", ",", "freq_min", "=", "None", ",", "freq_max", "=", "None", ")", ":", "if", "self", ...
Prepare thermal displacement matrices Parameters ---------- t_min, t_max, t_step : float, optional Minimum and maximum temperatures and the interval in this temperature range. Default valuues are 0, 1000, and 10. freq_min, freq_max : float, optional P...
[ "Prepare", "thermal", "displacement", "matrices" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L2016-L2066
241,363
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.set_modulations
def set_modulations(self, dimension, phonon_modes, delta_q=None, derivative_order=None, nac_q_direction=None): """Generate atomic displacements of phonon modes. The design of this fea...
python
def set_modulations(self, dimension, phonon_modes, delta_q=None, derivative_order=None, nac_q_direction=None): if self._dynamical_matrix is None: msg = ("Dynamical matrix has not y...
[ "def", "set_modulations", "(", "self", ",", "dimension", ",", "phonon_modes", ",", "delta_q", "=", "None", ",", "derivative_order", "=", "None", ",", "nac_q_direction", "=", "None", ")", ":", "if", "self", ".", "_dynamical_matrix", "is", "None", ":", "msg", ...
Generate atomic displacements of phonon modes. The design of this feature is not very satisfactory, and thus API. Therefore it should be reconsidered someday in the fugure. Parameters ---------- dimension : array_like Supercell dimension with respect to the primitive...
[ "Generate", "atomic", "displacements", "of", "phonon", "modes", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L2204-L2242
241,364
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.set_irreps
def set_irreps(self, q, is_little_cogroup=False, nac_q_direction=None, degeneracy_tolerance=1e-4): """Identify ir-reps of phonon modes. The design of this API is not very satisfactory and is expceted to be redesined in ...
python
def set_irreps(self, q, is_little_cogroup=False, nac_q_direction=None, degeneracy_tolerance=1e-4): if self._dynamical_matrix is None: msg = ("Dynamical matrix has not yet built.") raise RuntimeError(msg) ...
[ "def", "set_irreps", "(", "self", ",", "q", ",", "is_little_cogroup", "=", "False", ",", "nac_q_direction", "=", "None", ",", "degeneracy_tolerance", "=", "1e-4", ")", ":", "if", "self", ".", "_dynamical_matrix", "is", "None", ":", "msg", "=", "(", "\"Dyna...
Identify ir-reps of phonon modes. The design of this API is not very satisfactory and is expceted to be redesined in the next major versions once the use case of the API for ir-reps feature becomes clearer.
[ "Identify", "ir", "-", "reps", "of", "phonon", "modes", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L2267-L2294
241,365
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.init_dynamic_structure_factor
def init_dynamic_structure_factor(self, Qpoints, T, atomic_form_factor_func=None, scattering_lengths=None, freq_min=None, ...
python
def init_dynamic_structure_factor(self, Qpoints, T, atomic_form_factor_func=None, scattering_lengths=None, freq_min=None, ...
[ "def", "init_dynamic_structure_factor", "(", "self", ",", "Qpoints", ",", "T", ",", "atomic_form_factor_func", "=", "None", ",", "scattering_lengths", "=", "None", ",", "freq_min", "=", "None", ",", "freq_max", "=", "None", ")", ":", "if", "self", ".", "_mes...
Initialize dynamic structure factor calculation. ******************************************************************* This is still an experimental feature. API can be changed without notification. ******************************************************************* Need to cal...
[ "Initialize", "dynamic", "structure", "factor", "calculation", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L2378-L2445
241,366
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.run_dynamic_structure_factor
def run_dynamic_structure_factor(self, Qpoints, T, atomic_form_factor_func=None, scattering_lengths=None, freq_min=None, ...
python
def run_dynamic_structure_factor(self, Qpoints, T, atomic_form_factor_func=None, scattering_lengths=None, freq_min=None, ...
[ "def", "run_dynamic_structure_factor", "(", "self", ",", "Qpoints", ",", "T", ",", "atomic_form_factor_func", "=", "None", ",", "scattering_lengths", "=", "None", ",", "freq_min", "=", "None", ",", "freq_max", "=", "None", ")", ":", "self", ".", "init_dynamic_...
Run dynamic structure factor calculation See the detail of parameters at Phonopy.init_dynamic_structure_factor().
[ "Run", "dynamic", "structure", "factor", "calculation" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L2447-L2468
241,367
atztogo/phonopy
phonopy/api_phonopy.py
Phonopy.save
def save(self, filename="phonopy_params.yaml", settings=None): """Save parameters in Phonopy instants into file. Parameters ---------- filename: str, optional File name. Default is "phonopy_params.yaml" settings: dict, optional I...
python
def save(self, filename="phonopy_params.yaml", settings=None): phpy_yaml = PhonopyYaml(calculator=self._calculator, settings=settings) phpy_yaml.set_phonon_info(self) with open(filename, 'w') as w: w.write(str(phpy_yaml))
[ "def", "save", "(", "self", ",", "filename", "=", "\"phonopy_params.yaml\"", ",", "settings", "=", "None", ")", ":", "phpy_yaml", "=", "PhonopyYaml", "(", "calculator", "=", "self", ".", "_calculator", ",", "settings", "=", "settings", ")", "phpy_yaml", ".",...
Save parameters in Phonopy instants into file. Parameters ---------- filename: str, optional File name. Default is "phonopy_params.yaml" settings: dict, optional It is described which parameters are written out. Only the settings expected to be update...
[ "Save", "parameters", "in", "Phonopy", "instants", "into", "file", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L2520-L2545
241,368
atztogo/phonopy
phonopy/phonon/mesh.py
length2mesh
def length2mesh(length, lattice, rotations=None): """Convert length to mesh for q-point sampling This conversion for each reciprocal axis follows VASP convention by N = max(1, int(l * |a|^* + 0.5)) 'int' means rounding down, not rounding to nearest integer. Parameters ---------- length...
python
def length2mesh(length, lattice, rotations=None): rec_lattice = np.linalg.inv(lattice) rec_lat_lengths = np.sqrt(np.diagonal(np.dot(rec_lattice.T, rec_lattice))) mesh_numbers = np.rint(rec_lat_lengths * length).astype(int) if rotations is not None: reclat_equiv = get_lattice_vector_equivalence(...
[ "def", "length2mesh", "(", "length", ",", "lattice", ",", "rotations", "=", "None", ")", ":", "rec_lattice", "=", "np", ".", "linalg", ".", "inv", "(", "lattice", ")", "rec_lat_lengths", "=", "np", ".", "sqrt", "(", "np", ".", "diagonal", "(", "np", ...
Convert length to mesh for q-point sampling This conversion for each reciprocal axis follows VASP convention by N = max(1, int(l * |a|^* + 0.5)) 'int' means rounding down, not rounding to nearest integer. Parameters ---------- length : float Length having the unit of direct space l...
[ "Convert", "length", "to", "mesh", "for", "q", "-", "point", "sampling" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/phonon/mesh.py#L41-L80
241,369
atztogo/phonopy
phonopy/phonon/thermal_displacement.py
ThermalMotion._get_population
def _get_population(self, freq, t): # freq in THz """Return phonon population number Three types of combinations of array inputs are possible. - single freq and single t - single freq and len(t) > 1 - len(freq) > 1 and single t """ condition = t > 1.0 i...
python
def _get_population(self, freq, t): # freq in THz condition = t > 1.0 if type(condition) == bool or type(condition) == np.bool_: if condition: return 1.0 / (np.exp(freq * THzToEv / (Kb * t)) - 1) else: return 0.0 else: vals = n...
[ "def", "_get_population", "(", "self", ",", "freq", ",", "t", ")", ":", "# freq in THz", "condition", "=", "t", ">", "1.0", "if", "type", "(", "condition", ")", "==", "bool", "or", "type", "(", "condition", ")", "==", "np", ".", "bool_", ":", "if", ...
Return phonon population number Three types of combinations of array inputs are possible. - single freq and single t - single freq and len(t) > 1 - len(freq) > 1 and single t
[ "Return", "phonon", "population", "number" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/phonon/thermal_displacement.py#L101-L120
241,370
atztogo/phonopy
phonopy/phonon/thermal_displacement.py
ThermalDisplacements._project_eigenvectors
def _project_eigenvectors(self): """Eigenvectors are projected along Cartesian direction""" self._p_eigenvectors = [] for vecs_q in self._eigenvectors: p_vecs_q = [] for vecs in vecs_q.T: p_vecs_q.append(np.dot(vecs.reshape(-1, 3), ...
python
def _project_eigenvectors(self): self._p_eigenvectors = [] for vecs_q in self._eigenvectors: p_vecs_q = [] for vecs in vecs_q.T: p_vecs_q.append(np.dot(vecs.reshape(-1, 3), self._projection_direction)) self._p_eig...
[ "def", "_project_eigenvectors", "(", "self", ")", ":", "self", ".", "_p_eigenvectors", "=", "[", "]", "for", "vecs_q", "in", "self", ".", "_eigenvectors", ":", "p_vecs_q", "=", "[", "]", "for", "vecs", "in", "vecs_q", ".", "T", ":", "p_vecs_q", ".", "a...
Eigenvectors are projected along Cartesian direction
[ "Eigenvectors", "are", "projected", "along", "Cartesian", "direction" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/phonon/thermal_displacement.py#L226-L236
241,371
atztogo/phonopy
phonopy/structure/spglib.py
get_symmetry
def get_symmetry(cell, symprec=1e-5, angle_tolerance=-1.0): """This gives crystal symmetry operations from a crystal structure. Args: cell: Crystal structrue given either in Atoms object or tuple. In the case given by a tuple, it has to follow the form below, (Lattice parameters...
python
def get_symmetry(cell, symprec=1e-5, angle_tolerance=-1.0): _set_no_error() lattice, positions, numbers, magmoms = _expand_cell(cell) if lattice is None: return None multi = 48 * len(positions) rotation = np.zeros((multi, 3, 3), dtype='intc') translation = np.zeros((multi, 3), dtype='d...
[ "def", "get_symmetry", "(", "cell", ",", "symprec", "=", "1e-5", ",", "angle_tolerance", "=", "-", "1.0", ")", ":", "_set_no_error", "(", ")", "lattice", ",", "positions", ",", "numbers", ",", "magmoms", "=", "_expand_cell", "(", "cell", ")", "if", "latt...
This gives crystal symmetry operations from a crystal structure. Args: cell: Crystal structrue given either in Atoms object or tuple. In the case given by a tuple, it has to follow the form below, (Lattice parameters in a 3x3 array (see the detail below), Fractional ato...
[ "This", "gives", "crystal", "symmetry", "operations", "from", "a", "crystal", "structure", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L51-L120
241,372
atztogo/phonopy
phonopy/structure/spglib.py
get_symmetry_dataset
def get_symmetry_dataset(cell, symprec=1e-5, angle_tolerance=-1.0, hall_number=0): """Search symmetry dataset from an input cell. Args: cell, symprec, angle_tolerance: See the docstring of get_symmetry. hall_...
python
def get_symmetry_dataset(cell, symprec=1e-5, angle_tolerance=-1.0, hall_number=0): _set_no_error() lattice, positions, numbers, _ = _expand_cell(cell) if lattice is None: return None spg_ds = spg.dataset(lattice, positi...
[ "def", "get_symmetry_dataset", "(", "cell", ",", "symprec", "=", "1e-5", ",", "angle_tolerance", "=", "-", "1.0", ",", "hall_number", "=", "0", ")", ":", "_set_no_error", "(", ")", "lattice", ",", "positions", ",", "numbers", ",", "_", "=", "_expand_cell",...
Search symmetry dataset from an input cell. Args: cell, symprec, angle_tolerance: See the docstring of get_symmetry. hall_number: If a serial number of Hall symbol (>0) is given, the database corresponding to the Hall symbol is made. Return: A dictionar...
[ "Search", "symmetry", "dataset", "from", "an", "input", "cell", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L123-L235
241,373
atztogo/phonopy
phonopy/structure/spglib.py
get_spacegroup
def get_spacegroup(cell, symprec=1e-5, angle_tolerance=-1.0, symbol_type=0): """Return space group in international table symbol and number as a string. If it fails, None is returned. """ _set_no_error() dataset = get_symmetry_dataset(cell, symprec=symprec, ...
python
def get_spacegroup(cell, symprec=1e-5, angle_tolerance=-1.0, symbol_type=0): _set_no_error() dataset = get_symmetry_dataset(cell, symprec=symprec, angle_tolerance=angle_tolerance) if dataset is None: return None spg_type = g...
[ "def", "get_spacegroup", "(", "cell", ",", "symprec", "=", "1e-5", ",", "angle_tolerance", "=", "-", "1.0", ",", "symbol_type", "=", "0", ")", ":", "_set_no_error", "(", ")", "dataset", "=", "get_symmetry_dataset", "(", "cell", ",", "symprec", "=", "sympre...
Return space group in international table symbol and number as a string. If it fails, None is returned.
[ "Return", "space", "group", "in", "international", "table", "symbol", "and", "number", "as", "a", "string", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L238-L255
241,374
atztogo/phonopy
phonopy/structure/spglib.py
get_hall_number_from_symmetry
def get_hall_number_from_symmetry(rotations, translations, symprec=1e-5): """Hall number is obtained from a set of symmetry operations. If it fails, None is returned. """ r = np.array(rotations, dtype='intc', order='C') t = np.array(translations, dtype='double', order='C') hall_number = spg.ha...
python
def get_hall_number_from_symmetry(rotations, translations, symprec=1e-5): r = np.array(rotations, dtype='intc', order='C') t = np.array(translations, dtype='double', order='C') hall_number = spg.hall_number_from_symmetry(r, t, symprec) return hall_number
[ "def", "get_hall_number_from_symmetry", "(", "rotations", ",", "translations", ",", "symprec", "=", "1e-5", ")", ":", "r", "=", "np", ".", "array", "(", "rotations", ",", "dtype", "=", "'intc'", ",", "order", "=", "'C'", ")", "t", "=", "np", ".", "arra...
Hall number is obtained from a set of symmetry operations. If it fails, None is returned.
[ "Hall", "number", "is", "obtained", "from", "a", "set", "of", "symmetry", "operations", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L258-L267
241,375
atztogo/phonopy
phonopy/structure/spglib.py
get_spacegroup_type
def get_spacegroup_type(hall_number): """Translate Hall number to space group type information. If it fails, None is returned. """ _set_no_error() keys = ('number', 'international_short', 'international_full', 'international', 'schoenflies', ...
python
def get_spacegroup_type(hall_number): _set_no_error() keys = ('number', 'international_short', 'international_full', 'international', 'schoenflies', 'hall_symbol', 'choice', 'pointgroup_schoenflies', 'pointgroup_int...
[ "def", "get_spacegroup_type", "(", "hall_number", ")", ":", "_set_no_error", "(", ")", "keys", "=", "(", "'number'", ",", "'international_short'", ",", "'international_full'", ",", "'international'", ",", "'schoenflies'", ",", "'hall_symbol'", ",", "'choice'", ",", ...
Translate Hall number to space group type information. If it fails, None is returned.
[ "Translate", "Hall", "number", "to", "space", "group", "type", "information", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L270-L298
241,376
atztogo/phonopy
phonopy/structure/spglib.py
get_pointgroup
def get_pointgroup(rotations): """Return point group in international table symbol and number. The symbols are mapped to the numbers as follows: 1 "1 " 2 "-1 " 3 "2 " 4 "m " 5 "2/m " 6 "222 " 7 "mm2 " 8 "mmm " 9 "4 " 10 "-4 " 11...
python
def get_pointgroup(rotations): _set_no_error() # (symbol, pointgroup_number, transformation_matrix) pointgroup = spg.pointgroup(np.array(rotations, dtype='intc', order='C')) _set_error_message() return pointgroup
[ "def", "get_pointgroup", "(", "rotations", ")", ":", "_set_no_error", "(", ")", "# (symbol, pointgroup_number, transformation_matrix)", "pointgroup", "=", "spg", ".", "pointgroup", "(", "np", ".", "array", "(", "rotations", ",", "dtype", "=", "'intc'", ",", "order...
Return point group in international table symbol and number. The symbols are mapped to the numbers as follows: 1 "1 " 2 "-1 " 3 "2 " 4 "m " 5 "2/m " 6 "222 " 7 "mm2 " 8 "mmm " 9 "4 " 10 "-4 " 11 "4/m " 12 "422 " 13 "4mm...
[ "Return", "point", "group", "in", "international", "table", "symbol", "and", "number", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L301-L343
241,377
atztogo/phonopy
phonopy/structure/spglib.py
standardize_cell
def standardize_cell(cell, to_primitive=False, no_idealize=False, symprec=1e-5, angle_tolerance=-1.0): """Return standardized cell. Args: cell, symprec, angle_tolerance: See the docstring of get_symmetry. ...
python
def standardize_cell(cell, to_primitive=False, no_idealize=False, symprec=1e-5, angle_tolerance=-1.0): _set_no_error() lattice, _positions, _numbers, _ = _expand_cell(cell) if lattice is None: return None # Ato...
[ "def", "standardize_cell", "(", "cell", ",", "to_primitive", "=", "False", ",", "no_idealize", "=", "False", ",", "symprec", "=", "1e-5", ",", "angle_tolerance", "=", "-", "1.0", ")", ":", "_set_no_error", "(", ")", "lattice", ",", "_positions", ",", "_num...
Return standardized cell. Args: cell, symprec, angle_tolerance: See the docstring of get_symmetry. to_primitive: bool: If True, the standardized primitive cell is created. no_idealize: bool: If True, it is disabled to idealize lengths and angles of ...
[ "Return", "standardized", "cell", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L346-L394
241,378
atztogo/phonopy
phonopy/structure/spglib.py
find_primitive
def find_primitive(cell, symprec=1e-5, angle_tolerance=-1.0): """Primitive cell is searched in the input cell. The primitive cell is returned by a tuple of (lattice, positions, numbers). If it fails, None is returned. """ _set_no_error() lattice, positions, numbers, _ = _expand_cell(cell) ...
python
def find_primitive(cell, symprec=1e-5, angle_tolerance=-1.0): _set_no_error() lattice, positions, numbers, _ = _expand_cell(cell) if lattice is None: return None num_atom_prim = spg.primitive(lattice, positions, numbers, ...
[ "def", "find_primitive", "(", "cell", ",", "symprec", "=", "1e-5", ",", "angle_tolerance", "=", "-", "1.0", ")", ":", "_set_no_error", "(", ")", "lattice", ",", "positions", ",", "numbers", ",", "_", "=", "_expand_cell", "(", "cell", ")", "if", "lattice"...
Primitive cell is searched in the input cell. The primitive cell is returned by a tuple of (lattice, positions, numbers). If it fails, None is returned.
[ "Primitive", "cell", "is", "searched", "in", "the", "input", "cell", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L432-L456
241,379
atztogo/phonopy
phonopy/structure/spglib.py
get_symmetry_from_database
def get_symmetry_from_database(hall_number): """Return symmetry operations corresponding to a Hall symbol. The Hall symbol is given by the serial number in between 1 and 530. The symmetry operations are given by a dictionary whose keys are 'rotations' and 'translations'. If it fails, None is return...
python
def get_symmetry_from_database(hall_number): _set_no_error() rotations = np.zeros((192, 3, 3), dtype='intc') translations = np.zeros((192, 3), dtype='double') num_sym = spg.symmetry_from_database(rotations, translations, hall_number) _set_error_message() if num_sym is None: return None...
[ "def", "get_symmetry_from_database", "(", "hall_number", ")", ":", "_set_no_error", "(", ")", "rotations", "=", "np", ".", "zeros", "(", "(", "192", ",", "3", ",", "3", ")", ",", "dtype", "=", "'intc'", ")", "translations", "=", "np", ".", "zeros", "("...
Return symmetry operations corresponding to a Hall symbol. The Hall symbol is given by the serial number in between 1 and 530. The symmetry operations are given by a dictionary whose keys are 'rotations' and 'translations'. If it fails, None is returned.
[ "Return", "symmetry", "operations", "corresponding", "to", "a", "Hall", "symbol", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L459-L480
241,380
atztogo/phonopy
phonopy/structure/spglib.py
get_grid_point_from_address
def get_grid_point_from_address(grid_address, mesh): """Return grid point index by tranlating grid address""" _set_no_error() return spg.grid_point_from_address(np.array(grid_address, dtype='intc'), np.array(mesh, dtype='intc'))
python
def get_grid_point_from_address(grid_address, mesh): _set_no_error() return spg.grid_point_from_address(np.array(grid_address, dtype='intc'), np.array(mesh, dtype='intc'))
[ "def", "get_grid_point_from_address", "(", "grid_address", ",", "mesh", ")", ":", "_set_no_error", "(", ")", "return", "spg", ".", "grid_point_from_address", "(", "np", ".", "array", "(", "grid_address", ",", "dtype", "=", "'intc'", ")", ",", "np", ".", "arr...
Return grid point index by tranlating grid address
[ "Return", "grid", "point", "index", "by", "tranlating", "grid", "address" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L486-L491
241,381
atztogo/phonopy
phonopy/structure/spglib.py
get_ir_reciprocal_mesh
def get_ir_reciprocal_mesh(mesh, cell, is_shift=None, is_time_reversal=True, symprec=1e-5, is_dense=False): """Return k-points mesh and k-point map to the irreducible k-points. ...
python
def get_ir_reciprocal_mesh(mesh, cell, is_shift=None, is_time_reversal=True, symprec=1e-5, is_dense=False): _set_no_error() lattice, positions, numbers, _ = _expand_cell(cell) ...
[ "def", "get_ir_reciprocal_mesh", "(", "mesh", ",", "cell", ",", "is_shift", "=", "None", ",", "is_time_reversal", "=", "True", ",", "symprec", "=", "1e-5", ",", "is_dense", "=", "False", ")", ":", "_set_no_error", "(", ")", "lattice", ",", "positions", ","...
Return k-points mesh and k-point map to the irreducible k-points. The symmetry is serched from the input cell. Parameters ---------- mesh : array_like Uniform sampling mesh numbers. dtype='intc', shape=(3,) cell : spglib cell tuple Crystal structure. is_shift : array_li...
[ "Return", "k", "-", "points", "mesh", "and", "k", "-", "point", "map", "to", "the", "irreducible", "k", "-", "points", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L494-L559
241,382
atztogo/phonopy
phonopy/structure/spglib.py
get_stabilized_reciprocal_mesh
def get_stabilized_reciprocal_mesh(mesh, rotations, is_shift=None, is_time_reversal=True, qpoints=None, is_dense=False): """Return k-point ma...
python
def get_stabilized_reciprocal_mesh(mesh, rotations, is_shift=None, is_time_reversal=True, qpoints=None, is_dense=False): _set_no_error() ...
[ "def", "get_stabilized_reciprocal_mesh", "(", "mesh", ",", "rotations", ",", "is_shift", "=", "None", ",", "is_time_reversal", "=", "True", ",", "qpoints", "=", "None", ",", "is_dense", "=", "False", ")", ":", "_set_no_error", "(", ")", "if", "is_dense", ":"...
Return k-point map to the irreducible k-points and k-point grid points. The symmetry is searched from the input rotation matrices in real space. Parameters ---------- mesh : array_like Uniform sampling mesh numbers. dtype='intc', shape=(3,) rotations : array_like Rotation m...
[ "Return", "k", "-", "point", "map", "to", "the", "irreducible", "k", "-", "points", "and", "k", "-", "point", "grid", "points", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L562-L631
241,383
atztogo/phonopy
phonopy/structure/spglib.py
relocate_BZ_grid_address
def relocate_BZ_grid_address(grid_address, mesh, reciprocal_lattice, # column vectors is_shift=None, is_dense=False): """Grid addresses are relocated to be inside first Brillouin zone. Number of...
python
def relocate_BZ_grid_address(grid_address, mesh, reciprocal_lattice, # column vectors is_shift=None, is_dense=False): _set_no_error() if is_shift is None: _is_shift = np.zeros(3, dtype='...
[ "def", "relocate_BZ_grid_address", "(", "grid_address", ",", "mesh", ",", "reciprocal_lattice", ",", "# column vectors", "is_shift", "=", "None", ",", "is_dense", "=", "False", ")", ":", "_set_no_error", "(", ")", "if", "is_shift", "is", "None", ":", "_is_shift"...
Grid addresses are relocated to be inside first Brillouin zone. Number of ir-grid-points inside Brillouin zone is returned. It is assumed that the following arrays have the shapes of bz_grid_address : (num_grid_points_in_FBZ, 3) bz_map (prod(mesh * 2), ) Note that the shape of grid_address...
[ "Grid", "addresses", "are", "relocated", "to", "be", "inside", "first", "Brillouin", "zone", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L751-L806
241,384
atztogo/phonopy
phonopy/structure/spglib.py
delaunay_reduce
def delaunay_reduce(lattice, eps=1e-5): """Run Delaunay reduction Args: lattice: Lattice parameters in the form of [[a_x, a_y, a_z], [b_x, b_y, b_z], [c_x, c_y, c_z]] symprec: float: Tolerance to check if volume is close to zero or not and ...
python
def delaunay_reduce(lattice, eps=1e-5): _set_no_error() delaunay_lattice = np.array(np.transpose(lattice), dtype='double', order='C') result = spg.delaunay_reduce(delaunay_lattice, float(eps)) _set_error_message() if result == 0: return None else: ...
[ "def", "delaunay_reduce", "(", "lattice", ",", "eps", "=", "1e-5", ")", ":", "_set_no_error", "(", ")", "delaunay_lattice", "=", "np", ".", "array", "(", "np", ".", "transpose", "(", "lattice", ")", ",", "dtype", "=", "'double'", ",", "order", "=", "'C...
Run Delaunay reduction Args: lattice: Lattice parameters in the form of [[a_x, a_y, a_z], [b_x, b_y, b_z], [c_x, c_y, c_z]] symprec: float: Tolerance to check if volume is close to zero or not and if two basis vectors are orthogon...
[ "Run", "Delaunay", "reduction" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L809-L841
241,385
atztogo/phonopy
phonopy/structure/spglib.py
niggli_reduce
def niggli_reduce(lattice, eps=1e-5): """Run Niggli reduction Args: lattice: Lattice parameters in the form of [[a_x, a_y, a_z], [b_x, b_y, b_z], [c_x, c_y, c_z]] eps: float: Tolerance to check if difference of norms of two basis ...
python
def niggli_reduce(lattice, eps=1e-5): _set_no_error() niggli_lattice = np.array(np.transpose(lattice), dtype='double', order='C') result = spg.niggli_reduce(niggli_lattice, float(eps)) _set_error_message() if result == 0: return None else: return np.array(np.transpose(niggli_la...
[ "def", "niggli_reduce", "(", "lattice", ",", "eps", "=", "1e-5", ")", ":", "_set_no_error", "(", ")", "niggli_lattice", "=", "np", ".", "array", "(", "np", ".", "transpose", "(", "lattice", ")", ",", "dtype", "=", "'double'", ",", "order", "=", "'C'", ...
Run Niggli reduction Args: lattice: Lattice parameters in the form of [[a_x, a_y, a_z], [b_x, b_y, b_z], [c_x, c_y, c_z]] eps: float: Tolerance to check if difference of norms of two basis vectors is close to zero or not and if tw...
[ "Run", "Niggli", "reduction" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/spglib.py#L844-L877
241,386
atztogo/phonopy
phonopy/file_IO.py
get_FORCE_SETS_lines
def get_FORCE_SETS_lines(dataset, forces=None): """Generate FORCE_SETS string See the format of dataset in the docstring of Phonopy.set_displacement_dataset. Optionally for the type-1 (traditional) format, forces can be given. In this case, sets of forces are unnecessary to be stored in the dataset...
python
def get_FORCE_SETS_lines(dataset, forces=None): if 'first_atoms' in dataset: return _get_FORCE_SETS_lines_type1(dataset, forces=forces) elif 'forces' in dataset: return _get_FORCE_SETS_lines_type2(dataset)
[ "def", "get_FORCE_SETS_lines", "(", "dataset", ",", "forces", "=", "None", ")", ":", "if", "'first_atoms'", "in", "dataset", ":", "return", "_get_FORCE_SETS_lines_type1", "(", "dataset", ",", "forces", "=", "forces", ")", "elif", "'forces'", "in", "dataset", "...
Generate FORCE_SETS string See the format of dataset in the docstring of Phonopy.set_displacement_dataset. Optionally for the type-1 (traditional) format, forces can be given. In this case, sets of forces are unnecessary to be stored in the dataset.
[ "Generate", "FORCE_SETS", "string" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/file_IO.py#L52-L65
241,387
atztogo/phonopy
phonopy/file_IO.py
write_FORCE_CONSTANTS
def write_FORCE_CONSTANTS(force_constants, filename='FORCE_CONSTANTS', p2s_map=None): """Write force constants in text file format. Parameters ---------- force_constants: ndarray Force constants shape=(n_satom,n_satom,3,3) or (n_patom,...
python
def write_FORCE_CONSTANTS(force_constants, filename='FORCE_CONSTANTS', p2s_map=None): lines = get_FORCE_CONSTANTS_lines(force_constants, p2s_map=p2s_map) with open(filename, 'w') as w: w.write("\n".join(lines))
[ "def", "write_FORCE_CONSTANTS", "(", "force_constants", ",", "filename", "=", "'FORCE_CONSTANTS'", ",", "p2s_map", "=", "None", ")", ":", "lines", "=", "get_FORCE_CONSTANTS_lines", "(", "force_constants", ",", "p2s_map", "=", "p2s_map", ")", "with", "open", "(", ...
Write force constants in text file format. Parameters ---------- force_constants: ndarray Force constants shape=(n_satom,n_satom,3,3) or (n_patom,n_satom,3,3) dtype=double filename: str Filename to be saved p2s_map: ndarray Primitive atom indices in supercell...
[ "Write", "force", "constants", "in", "text", "file", "format", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/file_IO.py#L243-L264
241,388
atztogo/phonopy
phonopy/file_IO.py
write_force_constants_to_hdf5
def write_force_constants_to_hdf5(force_constants, filename='force_constants.hdf5', p2s_map=None, physical_unit=None, compression=None): """Write force constants in hdf5 format. ...
python
def write_force_constants_to_hdf5(force_constants, filename='force_constants.hdf5', p2s_map=None, physical_unit=None, compression=None): try: import h5py except ImportE...
[ "def", "write_force_constants_to_hdf5", "(", "force_constants", ",", "filename", "=", "'force_constants.hdf5'", ",", "p2s_map", "=", "None", ",", "physical_unit", "=", "None", ",", "compression", "=", "None", ")", ":", "try", ":", "import", "h5py", "except", "Im...
Write force constants in hdf5 format. Parameters ---------- force_constants: ndarray Force constants shape=(n_satom,n_satom,3,3) or (n_patom,n_satom,3,3) dtype=double filename: str Filename to be saved p2s_map: ndarray Primitive atom indices in supercell inde...
[ "Write", "force", "constants", "in", "hdf5", "format", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/file_IO.py#L285-L326
241,389
atztogo/phonopy
phonopy/phonon/band_structure.py
get_band_qpoints
def get_band_qpoints(band_paths, npoints=51, rec_lattice=None): """Generate qpoints for band structure path Note ---- Behavior changes with and without rec_lattice given. Parameters ---------- band_paths: list of array_likes Sets of end points of paths dtype='double' ...
python
def get_band_qpoints(band_paths, npoints=51, rec_lattice=None): npts = _get_npts(band_paths, npoints, rec_lattice) qpoints_of_paths = [] c = 0 for band_path in band_paths: nd = len(band_path) for i in range(nd - 1): delta = np.subtract(band_path[i + 1], band_path[i]) / (npts[...
[ "def", "get_band_qpoints", "(", "band_paths", ",", "npoints", "=", "51", ",", "rec_lattice", "=", "None", ")", ":", "npts", "=", "_get_npts", "(", "band_paths", ",", "npoints", ",", "rec_lattice", ")", "qpoints_of_paths", "=", "[", "]", "c", "=", "0", "f...
Generate qpoints for band structure path Note ---- Behavior changes with and without rec_lattice given. Parameters ---------- band_paths: list of array_likes Sets of end points of paths dtype='double' shape=(sets of paths, paths, 3) example: [[[0, ...
[ "Generate", "qpoints", "for", "band", "structure", "path" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/phonon/band_structure.py#L70-L112
241,390
atztogo/phonopy
phonopy/phonon/band_structure.py
get_band_qpoints_by_seekpath
def get_band_qpoints_by_seekpath(primitive, npoints, is_const_interval=False): """q-points along BZ high symmetry paths are generated using seekpath. Parameters ---------- primitive : PhonopyAtoms Primitive cell. npoints : int Number of q-points sampled along a path including end po...
python
def get_band_qpoints_by_seekpath(primitive, npoints, is_const_interval=False): try: import seekpath except ImportError: raise ImportError("You need to install seekpath.") band_path = seekpath.get_path(primitive.totuple()) point_coords = band_path['point_coords'] qpoints_of_paths = [...
[ "def", "get_band_qpoints_by_seekpath", "(", "primitive", ",", "npoints", ",", "is_const_interval", "=", "False", ")", ":", "try", ":", "import", "seekpath", "except", "ImportError", ":", "raise", "ImportError", "(", "\"You need to install seekpath.\"", ")", "band_path...
q-points along BZ high symmetry paths are generated using seekpath. Parameters ---------- primitive : PhonopyAtoms Primitive cell. npoints : int Number of q-points sampled along a path including end points. is_const_interval : bool, optional When True, q-points are sampled i...
[ "q", "-", "points", "along", "BZ", "high", "symmetry", "paths", "are", "generated", "using", "seekpath", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/phonon/band_structure.py#L115-L165
241,391
atztogo/phonopy
phonopy/harmonic/dynmat_to_fc.py
get_commensurate_points
def get_commensurate_points(supercell_matrix): # wrt primitive cell """Commensurate q-points are returned. Parameters ---------- supercell_matrix : array_like Supercell matrix with respect to primitive cell basis vectors. shape=(3, 3) dtype=intc """ smat = np.array(su...
python
def get_commensurate_points(supercell_matrix): # wrt primitive cell smat = np.array(supercell_matrix, dtype=int) rec_primitive = PhonopyAtoms(numbers=[1], scaled_positions=[[0, 0, 0]], cell=np.diag([1, 1, 1]), pb...
[ "def", "get_commensurate_points", "(", "supercell_matrix", ")", ":", "# wrt primitive cell", "smat", "=", "np", ".", "array", "(", "supercell_matrix", ",", "dtype", "=", "int", ")", "rec_primitive", "=", "PhonopyAtoms", "(", "numbers", "=", "[", "1", "]", ",",...
Commensurate q-points are returned. Parameters ---------- supercell_matrix : array_like Supercell matrix with respect to primitive cell basis vectors. shape=(3, 3) dtype=intc
[ "Commensurate", "q", "-", "points", "are", "returned", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/harmonic/dynmat_to_fc.py#L42-L62
241,392
atztogo/phonopy
phonopy/harmonic/dynmat_to_fc.py
get_commensurate_points_in_integers
def get_commensurate_points_in_integers(supercell_matrix): """Commensurate q-points in integer representation are returned. A set of integer representation of lattice points is transformed to the equivalent set of lattice points in fractional coordinates with respect to supercell basis vectors by ...
python
def get_commensurate_points_in_integers(supercell_matrix): smat = np.array(supercell_matrix, dtype=int) snf = SNF3x3(smat.T) snf.run() D = snf.A.diagonal() b, c, a = np.meshgrid(range(D[1]), range(D[2]), range(D[0])) lattice_points = np.dot(np.c_[a.ravel() * D[1] * D[2], ...
[ "def", "get_commensurate_points_in_integers", "(", "supercell_matrix", ")", ":", "smat", "=", "np", ".", "array", "(", "supercell_matrix", ",", "dtype", "=", "int", ")", "snf", "=", "SNF3x3", "(", "smat", ".", "T", ")", "snf", ".", "run", "(", ")", "D", ...
Commensurate q-points in integer representation are returned. A set of integer representation of lattice points is transformed to the equivalent set of lattice points in fractional coordinates with respect to supercell basis vectors by integer_lattice_points / det(supercell_matrix) Parameters ...
[ "Commensurate", "q", "-", "points", "in", "integer", "representation", "are", "returned", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/harmonic/dynmat_to_fc.py#L65-L97
241,393
atztogo/phonopy
phonopy/interface/vasp.py
write_vasp
def write_vasp(filename, cell, direct=True): """Write crystal structure to a VASP POSCAR style file. Parameters ---------- filename : str Filename. cell : PhonopyAtoms Crystal structure. direct : bool, optional In 'Direct' or not in VASP POSCAR format. Default is True. ...
python
def write_vasp(filename, cell, direct=True): lines = get_vasp_structure_lines(cell, direct=direct) with open(filename, 'w') as w: w.write("\n".join(lines))
[ "def", "write_vasp", "(", "filename", ",", "cell", ",", "direct", "=", "True", ")", ":", "lines", "=", "get_vasp_structure_lines", "(", "cell", ",", "direct", "=", "direct", ")", "with", "open", "(", "filename", ",", "'w'", ")", "as", "w", ":", "w", ...
Write crystal structure to a VASP POSCAR style file. Parameters ---------- filename : str Filename. cell : PhonopyAtoms Crystal structure. direct : bool, optional In 'Direct' or not in VASP POSCAR format. Default is True.
[ "Write", "crystal", "structure", "to", "a", "VASP", "POSCAR", "style", "file", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/interface/vasp.py#L249-L265
241,394
atztogo/phonopy
phonopy/interface/qe.py
PwscfIn._set_lattice
def _set_lattice(self): """Calculate and set lattice parameters. Invoked by CELL_PARAMETERS tag. """ unit = self._values[0] if unit == 'alat': if not self._tags['celldm(1)']: print("celldm(1) has to be specified when using alat.") sy...
python
def _set_lattice(self): unit = self._values[0] if unit == 'alat': if not self._tags['celldm(1)']: print("celldm(1) has to be specified when using alat.") sys.exit(1) else: factor = self._tags['celldm(1)'] # in Bohr elif uni...
[ "def", "_set_lattice", "(", "self", ")", ":", "unit", "=", "self", ".", "_values", "[", "0", "]", "if", "unit", "==", "'alat'", ":", "if", "not", "self", ".", "_tags", "[", "'celldm(1)'", "]", ":", "print", "(", "\"celldm(1) has to be specified when using ...
Calculate and set lattice parameters. Invoked by CELL_PARAMETERS tag.
[ "Calculate", "and", "set", "lattice", "parameters", "." ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/interface/qe.py#L278-L302
241,395
atztogo/phonopy
phonopy/interface/qe.py
PH_Q2R.run
def run(self, cell, is_full_fc=False, parse_fc=True): """Make supercell force constants readable for phonopy Note ---- Born effective charges and dielectric constant tensor are read from QE output file if they exist. But this means dipole-dipole contributions are removed...
python
def run(self, cell, is_full_fc=False, parse_fc=True): with open(self._filename) as f: fc_dct = self._parse_q2r(f) self.dimension = fc_dct['dimension'] self.epsilon = fc_dct['dielectric'] self.borns = fc_dct['born'] if parse_fc: (self.fc...
[ "def", "run", "(", "self", ",", "cell", ",", "is_full_fc", "=", "False", ",", "parse_fc", "=", "True", ")", ":", "with", "open", "(", "self", ".", "_filename", ")", "as", "f", ":", "fc_dct", "=", "self", ".", "_parse_q2r", "(", "f", ")", "self", ...
Make supercell force constants readable for phonopy Note ---- Born effective charges and dielectric constant tensor are read from QE output file if they exist. But this means dipole-dipole contributions are removed from force constants and this force constants matrix is ...
[ "Make", "supercell", "force", "constants", "readable", "for", "phonopy" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/interface/qe.py#L416-L447
241,396
atztogo/phonopy
phonopy/interface/qe.py
PH_Q2R._parse_q2r
def _parse_q2r(self, f): """Parse q2r output file The format of q2r output is described at the mailing list below: http://www.democritos.it/pipermail/pw_forum/2005-April/002408.html http://www.democritos.it/pipermail/pw_forum/2008-September/010099.html http://www.democritos.it/p...
python
def _parse_q2r(self, f): natom, dim, epsilon, borns = self._parse_parameters(f) fc_dct = {'fc': self._parse_fc(f, natom, dim), 'dimension': dim, 'dielectric': epsilon, 'born': borns} return fc_dct
[ "def", "_parse_q2r", "(", "self", ",", "f", ")", ":", "natom", ",", "dim", ",", "epsilon", ",", "borns", "=", "self", ".", "_parse_parameters", "(", "f", ")", "fc_dct", "=", "{", "'fc'", ":", "self", ".", "_parse_fc", "(", "f", ",", "natom", ",", ...
Parse q2r output file The format of q2r output is described at the mailing list below: http://www.democritos.it/pipermail/pw_forum/2005-April/002408.html http://www.democritos.it/pipermail/pw_forum/2008-September/010099.html http://www.democritos.it/pipermail/pw_forum/2009-August/013613...
[ "Parse", "q2r", "output", "file" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/interface/qe.py#L457-L473
241,397
atztogo/phonopy
phonopy/interface/qe.py
PH_Q2R._parse_fc
def _parse_fc(self, f, natom, dim): """Parse force constants part Physical unit of force cosntants in the file is Ry/au^2. """ ndim = np.prod(dim) fc = np.zeros((natom, natom * ndim, 3, 3), dtype='double', order='C') for k, l, i, j in np.ndindex((3, 3, natom, natom)): ...
python
def _parse_fc(self, f, natom, dim): ndim = np.prod(dim) fc = np.zeros((natom, natom * ndim, 3, 3), dtype='double', order='C') for k, l, i, j in np.ndindex((3, 3, natom, natom)): line = f.readline() for i_dim in range(ndim): line = f.readline() ...
[ "def", "_parse_fc", "(", "self", ",", "f", ",", "natom", ",", "dim", ")", ":", "ndim", "=", "np", ".", "prod", "(", "dim", ")", "fc", "=", "np", ".", "zeros", "(", "(", "natom", ",", "natom", "*", "ndim", ",", "3", ",", "3", ")", ",", "dtyp...
Parse force constants part Physical unit of force cosntants in the file is Ry/au^2.
[ "Parse", "force", "constants", "part" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/interface/qe.py#L507-L522
241,398
atztogo/phonopy
phonopy/interface/cp2k.py
get_cp2k_structure
def get_cp2k_structure(atoms): """Convert the atoms structure to a CP2K input file skeleton string""" from cp2k_tools.generator import dict2cp2k # CP2K's default unit is angstrom, convert it, but still declare it explictly: cp2k_cell = {sym: ('[angstrom]',) + tuple(coords) for sym, coords in zip(('a',...
python
def get_cp2k_structure(atoms): from cp2k_tools.generator import dict2cp2k # CP2K's default unit is angstrom, convert it, but still declare it explictly: cp2k_cell = {sym: ('[angstrom]',) + tuple(coords) for sym, coords in zip(('a', 'b', 'c'), atoms.get_cell()*Bohr)} cp2k_cell['periodic'] = 'XYZ' # any...
[ "def", "get_cp2k_structure", "(", "atoms", ")", ":", "from", "cp2k_tools", ".", "generator", "import", "dict2cp2k", "# CP2K's default unit is angstrom, convert it, but still declare it explictly:", "cp2k_cell", "=", "{", "sym", ":", "(", "'[angstrom]'", ",", ")", "+", "...
Convert the atoms structure to a CP2K input file skeleton string
[ "Convert", "the", "atoms", "structure", "to", "a", "CP2K", "input", "file", "skeleton", "string" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/interface/cp2k.py#L126-L156
241,399
atztogo/phonopy
phonopy/api_qha.py
PhonopyQHA.plot_qha
def plot_qha(self, thin_number=10, volume_temp_exp=None): """Returns matplotlib.pyplot of QHA fitting curves at temperatures""" return self._qha.plot(thin_number=thin_number, volume_temp_exp=volume_temp_exp)
python
def plot_qha(self, thin_number=10, volume_temp_exp=None): return self._qha.plot(thin_number=thin_number, volume_temp_exp=volume_temp_exp)
[ "def", "plot_qha", "(", "self", ",", "thin_number", "=", "10", ",", "volume_temp_exp", "=", "None", ")", ":", "return", "self", ".", "_qha", ".", "plot", "(", "thin_number", "=", "thin_number", ",", "volume_temp_exp", "=", "volume_temp_exp", ")" ]
Returns matplotlib.pyplot of QHA fitting curves at temperatures
[ "Returns", "matplotlib", ".", "pyplot", "of", "QHA", "fitting", "curves", "at", "temperatures" ]
869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_qha.py#L137-L140