### Install PyPWDFT with PyPI Source: https://ifilot.github.io/pypwdft/installation.html Use this command in a terminal to install PyPWDFT and its dependencies via pip. ```bash pip install pypwdft mendeleev pyfftw ``` -------------------------------- ### Verify PyPWDFT Installation Source: https://ifilot.github.io/pypwdft/installation.html Run this Python code snippet to check if PyPWDFT is installed correctly and print its version. ```python import pypwdft print(pypwdft.__version__) ``` -------------------------------- ### Install PyPWDFT with Anaconda Source: https://ifilot.github.io/pypwdft/installation.html Use this command in an Anaconda command prompt to install PyPWDFT and its dependencies. ```bash conda install -c ifilot pypwdft mendeleev pyfftw ``` -------------------------------- ### PeriodicSystem.get_ct Source: https://ifilot.github.io/pypwdft/api.html Gets the FFT transformation constant, used for converting between canonical FFT and FFTs with normalized plane wave basis sets. ```APIDOC ## PeriodicSystem.get_ct ### Description Get the FFT transformation constant from canonical FFT to an FFT using a normalized plane wave basis set. ### Returns FFT transformation constant ### Return type float ``` -------------------------------- ### SystemBuilder.from_file Source: https://ifilot.github.io/pypwdft/api.html Constructs a system from a specified input file. ```APIDOC ## SystemBuilder.from_file ### Description Build a system from a file. ### Parameters * **filepath** (str) – Path to the input file. ``` -------------------------------- ### SystemBuilder.from_name Source: https://ifilot.github.io/pypwdft/api.html Constructs a system from a predefined material name. ```APIDOC ## SystemBuilder.from_name ### Description Build a system from a material name. ### Parameters * **name** (str) – Name of the material. ``` -------------------------------- ### Set up and Perform SCF Calculation Source: https://ifilot.github.io/pypwdft/usage.html This snippet demonstrates how to create a periodic system, initialize the PyPWDFT calculator, and run the self-consistent field (SCF) procedure. It shows setting up a CH4 molecule in a cubic lattice and performing the SCF calculation with verbose output and a specified tolerance. ```python from pypwdft import PyPWDFT, PeriodicSystem, SystemBuilder # create cubic periodic system with lattice size of 10 Bohr units npts = 32 # number of grid points sz = 10 # construct CH4 molecule system via SystemBuilder s = SystemBuilder().from_name('CH4', sz=sz, npts=npts) # construct calculator object calculator = PyPWDFT(s) # perform self-consistent field procedure and store results in res object res = calculator.scf(tol=1e-5, verbose=True) ``` -------------------------------- ### PyPWDFT.__init__ Source: https://ifilot.github.io/pypwdft/api.html Initializes the main PyPWDFT calculator class. ```APIDOC ## PyPWDFT.__init__ ### Description Initializes the PyPWDFT calculator. ``` -------------------------------- ### SystemBuilder.__init__ Source: https://ifilot.github.io/pypwdft/api.html Initializes the SystemBuilder class, used for constructing system objects. ```APIDOC ## SystemBuilder.__init__ ### Description Initializes the SystemBuilder. ``` -------------------------------- ### SystemBuilder.from_file Source: https://ifilot.github.io/pypwdft/api.html Constructs a PeriodicSystem instance from a .xyz file. This method allows specifying the file path, the edge size of the unit cell, and the number of sampling points. ```APIDOC ## SystemBuilder.from_file ### Description Constructs a PeriodicSystem instance from a .xyz file. ### Method `from_file(_path: str_, _sz: float = 10_, _npts: int = 32_)` ### Parameters #### Path Parameters - **path** (str) - Path to .xyz file #### Optional Parameters - **sz** (float) - Edge size of the cubic unit cell in a.u. Defaults to 10 a.u. - **npts** (int) - Number of sampling points per Cartesian direction. Defaults to 32. ### Returns PeriodicSystem instance encapsulating the specified molecule. ### Return Type PeriodicSystem ``` -------------------------------- ### Create Periodic System Manually Source: https://ifilot.github.io/pypwdft/usage.html Manually create a cubic periodic system by defining lattice size and grid points. ```python from pypwdft import PeriodicSystem npts = 32 # number of grid points sz = 10 # edge size of cubic unit cell s = PeriodicSystem(sz, npts) ``` -------------------------------- ### Build CH4 System Automatically Source: https://ifilot.github.io/pypwdft/usage.html Use SystemBuilder to create a cubic periodic system for a CH4 molecule. Specify lattice size and grid points. ```python from pypwdft import SystemBuilder, PeriodicSystem # create cubic periodic system with lattice size of 10 Bohr units npts = 16 # number of grid points sz = 10 # construct CH4 molecule system via SystemBuilder s = SystemBuilder().from_name('CH4', sz=sz, npts=npts) ``` -------------------------------- ### pypwdft.SystemBuilder methods Source: https://ifilot.github.io/pypwdft/genindex.html Methods available for the SystemBuilder class, used for constructing system objects. ```APIDOC ## __init__() SystemBuilder ### Description Initializes a SystemBuilder object. This is a constructor method. ### Method Constructor ### Parameters None explicitly documented. ### Response Initializes a SystemBuilder object. ``` ```APIDOC ## from_file() SystemBuilder ### Description Builds a system from a file. ### Method Method ### Parameters None explicitly documented. ### Response Returns a system object built from the file. ``` ```APIDOC ## from_name() SystemBuilder ### Description Builds a system from a name. ### Method Method ### Parameters None explicitly documented. ### Response Returns a system object built from the name. ``` -------------------------------- ### Perform SCF Calculation and Generate Isosurfaces Source: https://ifilot.github.io/pypwdft/usage.html This snippet demonstrates a full workflow: setting up a periodic system, performing a Self-Consistent Field (SCF) calculation, interpolating the resulting scalar fields using quintic interpolation, and generating isosurfaces for molecular orbitals using PyTessel. It includes generating positive and negative real and imaginary isosurfaces for different orbitals. ```python import numpy as np from pytessel import PyTessel from scipy.interpolate import RegularGridInterpolator from pypwdft import PyPWDFT, SystemBuilder, PeriodicSystem def main(): # create cubic periodic system with lattice size of 10 Bohr units npts = 32 # number of grid points sz = 10 # construct CO molecule system via SystemBuilder s = SystemBuilder().from_name('CO', sz=sz, npts=npts) # construct calculator object calculator = PyPWDFT(s) # perform self-consistent field procedure and store results in res object res = calculator.scf(tol=1e-5, nsol=9, verbose=True) # generate PyTessel object pytessel = PyTessel() for i in range(2,9): print('Building isosurfaces: %02i' % (i+1)) scalarfield = interpolate_grid(res['orbc_rs'][i], sz, npts, 4) unitcell = np.identity(3) * sz # build positive real isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.real.flatten(), scalarfield.shape, unitcell.flatten(), 0.1) pytessel.write_ply('MO_PR_%02i.ply' % (i+1), vertices, normals, indices) # build negative real isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.real.flatten(), scalarfield.shape, unitcell.flatten(), -0.1) pytessel.write_ply('MO_NR_%02i.ply' % (i+1), vertices, normals, indices) # build positive imaginary isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.imag.flatten(), scalarfield.shape, unitcell.flatten(), 0.1) pytessel.write_ply('MO_PI_%02i.ply' % (i+1), vertices, normals, indices) # build negative imaginary isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.imag.flatten(), scalarfield.shape, unitcell.flatten(), -0.1) pytessel.write_ply('MO_NI_%02i.ply' % (i+1), vertices, normals, indices) def interpolate_grid(scalarfield, sz, npts, amp=2): x = np.linspace(0, sz, npts) interp = RegularGridInterpolator((x,x,x), scalarfield, method='quintic') s = PeriodicSystem(sz, npts * amp) points = s.get_r() return interp(points) if __name__ == '__main__': main() ``` -------------------------------- ### PeriodicSystem.__init__ Source: https://ifilot.github.io/pypwdft/api.html Initializes a PeriodicSystem object to represent a cubic unit cell with periodic boundary conditions. It sets up the sampling grid for nuclei and electrons. ```APIDOC ## PeriodicSystem.__init__ ### Description Build a periodic system. ### Parameters * **sz** (float) – edge size of the cubic unit cell * **npts** (int) – number of sampling points per Cartesian direction ``` -------------------------------- ### Frequency Domain Upsampling for Molecular Orbitals Source: https://ifilot.github.io/pypwdft/usage.html This script demonstrates frequency domain upsampling to visualize molecular orbitals. It sets up a periodic system, performs SCF calculations, and generates isosurfaces for both real and imaginary parts of the orbitals using marching cubes. The `upsample_grid` function handles the frequency domain upsampling. ```python import numpy as np from pytessel import PyTessel from pypwdft import PyPWDFT, SystemBuilder def main(): # create cubic periodic system with lattice size of 10 Bohr units npts = 32 # number of grid points sz = 10 # construct CO molecule system via SystemBuilder s = SystemBuilder().from_name('CH4', sz=sz, npts=npts) # construct calculator object calculator = PyPWDFT(s) # perform self-consistent field procedure and store results in res object res = calculator.scf(tol=1e-5, verbose=True) # print molecular orbital energies print(res['orbe']) # generate PyTessel object pytessel = PyTessel() for i in range(5): print('Building isosurfaces: %02i' % (i+1)) scalarfield = upsample_grid(res['orbc_fft'][i], sz**3, 4) unitcell = np.identity(3) * sz # build positive real isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.real.flatten(), scalarfield.shape, unitcell.flatten(), 0.03) pytessel.write_ply('MO_PR_%02i.ply' % (i+1), vertices, normals, indices) # build negative real isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.real.flatten(), scalarfield.shape, unitcell.flatten(), -0.03) pytessel.write_ply('MO_NR_%02i.ply' % (i+1), vertices, normals, indices) # build positive imaginary isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.imag.flatten(), scalarfield.shape, unitcell.flatten(), 0.03) pytessel.write_ply('MO_PI_%02i.ply' % (i+1), vertices, normals, indices) # build negative imaginary isosurface vertices, normals, indices = pytessel.marching_cubes(scalarfield.imag.flatten(), scalarfield.shape, unitcell.flatten(), -0.03) pytessel.write_ply('MO_NI_%02i.ply' % (i+1), vertices, normals, indices) def upsample_grid(scalarfield_fft, Omega, upsample=4): Nx, Ny, Nz = scalarfield_fft.shape Nx_up = Nx * upsample Ny_up = Nx * upsample Nz_up = Nx * upsample # shift the frequencies fft = np.fft.fftshift(scalarfield_fft) # perform padding fft_upsampled = np.pad(fft, [((Nz_up-Nz)//2,), ((Ny_up-Ny)//2,), ((Nx_up-Nx)//2,)], 'constant') # shift back fft_hires = np.fft.ifftshift(fft_upsampled) return np.fft.ifftn(fft_hires) * np.prod([Nx_up, Ny_up, Nz_up]) / np.sqrt(Omega) if __name__ == '__main__': main() ``` -------------------------------- ### SystemBuilder.from_name Source: https://ifilot.github.io/pypwdft/api.html Creates a PeriodicSystem instance by specifying the name of the molecule. This method is useful for building systems from a predefined list of molecules and allows setting the unit cell size and sampling points. ```APIDOC ## SystemBuilder.from_name ### Description Creates a PeriodicSystem instance by specifying the name of the molecule. ### Method `from_name(_molname: str_, _sz: float = 10_, _npts: int = 32_)` ### Parameters #### Path Parameters - **molname** (str) - Name of the molecule #### Optional Parameters - **sz** (float) - Edge size of the cubic unit cell in a.u. Defaults to 10 a.u. - **npts** (int) - Number of sampling points per Cartesian direction. Defaults to 32. ### Returns PeriodicSystem instance encapsulating the specified molecule. ### Return Type PeriodicSystem ``` -------------------------------- ### Print System Details Source: https://ifilot.github.io/pypwdft/usage.html Print the unit cell matrix and atomic coordinates of a defined system. ```python print(s) ``` -------------------------------- ### Visualize Molecular Orbitals in 2D Projections Source: https://ifilot.github.io/pypwdft/usage.html This script visualizes the real part, imaginary part, and electron density of molecular orbitals from a CH4 molecule calculation. It uses matplotlib to display 2D slices of the orbitals at a specific z-layer. ```python # import the required libraries for the test from pypwdft import PyPWDFT, PeriodicSystem, SystemBuilder import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable def main(): # create cubic periodic system with lattice size of 10 Bohr units npts = 32 # number of grid points sz = 10 # construct CH4 molecule system via SystemBuilder s = SystemBuilder().from_name('CH4', sz=sz, npts=npts) # construct calculator object calculator = PyPWDFT(s) # perform self-consistent field procedure and store results in res object res = calculator.scf(tol=1e-1, verbose=True) # visualize the occupied molecular orbitals fig, im = plt.subplots(3,5, dpi=300, figsize=(16,8)) extent=[-sz/2,sz/2,-sz/2,sz/2] orbe = res['orbe'] fig.suptitle('Occupied molecular orbitals of CH$_{4}$') m = np.empty((3,5), dtype=object) # create placeholder for maps for i in range(0,5): # visualize the real part of the wave function field = np.real(res['orbc_rs'][i][npts//2, :, :]) maxval = max(np.max(np.abs(field)), 0.1) m[0][i] = im[0,i].imshow(field, origin='lower', interpolation='bicubic', extent=extent, cmap='PiYG', vmin=-maxval, vmax=maxval) im[0,i].set_title(r'$\\mathbb{R}\\;[\\psi_{%i}]$' % (i+1)) # visualize the imaginary part of the wave function field = np.imag(res['orbc_rs'][i][npts//2, :, :]) maxval = max(np.max(np.abs(field)), 0.001) m[1][i] = im[1,i].imshow(field, origin='lower', interpolation='bicubic', extent=extent, cmap='PiYG', vmin=-maxval, vmax=maxval) im[1,i].set_title(r'$\\mathbb{I}\\;[\\psi_{%i}]$' % (i+1)) # visualize the electron density m[2][i] = im[2,i].imshow(np.real(res['orbc_rs'][i][npts//2, :, :].conj() * res['orbc_rs'][i][npts//2, :, :])), origin='lower', interpolation='bicubic', extent=extent) im[2,i].set_title(r'$\\rho_{%i}$' % (i+1)) for j in range(0,3): for i in range(0,5): im[j,i].set_xlabel('$x$-position [a.u.]') im[j,i].set_ylabel('$y$-position [a.u.]') divider = make_axes_locatable(im[j,i]) cax = divider.append_axes('right', size='5%', pad=0.05) fig.colorbar(m[j][i], cax=cax, orientation='vertical') plt.tight_layout() if __name__ == '__main__': main() ``` -------------------------------- ### pypwdft.PeriodicSystem methods Source: https://ifilot.github.io/pypwdft/genindex.html Methods available for the PeriodicSystem class, used for managing and querying properties of a periodic system. ```APIDOC ## __init__() PeriodicSystem ### Description Initializes a PeriodicSystem object. This is a constructor method. ### Method Constructor ### Parameters None explicitly documented. ### Response Initializes a PeriodicSystem object. ``` ```APIDOC ## add_atom() PeriodicSystem ### Description Adds an atom to the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Adds an atom to the system. ``` ```APIDOC ## calculate_ewald_sum() PeriodicSystem ### Description Calculates the Ewald sum for the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the calculated Ewald sum. ``` ```APIDOC ## calculate_vpot() PeriodicSystem ### Description Calculates the potential of the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the calculated potential. ``` ```APIDOC ## get_atom_charges() PeriodicSystem ### Description Retrieves the charges of the atoms in the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the atom charges. ``` ```APIDOC ## get_atom_positions() PeriodicSystem ### Description Retrieves the positions of the atoms in the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the atom positions. ``` ```APIDOC ## get_ct() PeriodicSystem ### Description Retrieves the CT value for the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the CT value. ``` ```APIDOC ## get_nelec() PeriodicSystem ### Description Retrieves the number of electrons in the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the number of electrons. ``` ```APIDOC ## get_npts() PeriodicSystem ### Description Retrieves the number of points in the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the number of points. ``` ```APIDOC ## get_omega() PeriodicSystem ### Description Retrieves the omega value for the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the omega value. ``` ```APIDOC ## get_pw_k() PeriodicSystem ### Description Retrieves the pw_k value for the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the pw_k value. ``` ```APIDOC ## get_pw_k2() PeriodicSystem ### Description Retrieves the pw_k2 value for the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the pw_k2 value. ``` ```APIDOC ## get_r() PeriodicSystem ### Description Retrieves the R value for the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the R value. ``` ```APIDOC ## get_r_norms() PeriodicSystem ### Description Retrieves the R norms for the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Returns the R norms. ``` ```APIDOC ## translate() PeriodicSystem ### Description Translates the periodic system. ### Method Method ### Parameters None explicitly documented. ### Response Translates the system. ``` -------------------------------- ### Perform DFT Calculation with PyPWDFT Source: https://ifilot.github.io/pypwdft/index.html This snippet demonstrates how to perform a self-consistent field calculation for a methane molecule using PyPWDFT. It requires importing necessary libraries, setting up the periodic system and molecule, initializing the calculator, and running the scf procedure. ```python # import the required libraries for the test from pypwdft import PyPWDFT, PeriodicSystem, MoleculeBuilder import numpy as np def main(): # create cubic periodic system with lattice size of 10 Bohr npts = 16 # number of grid points sz = 10 # construct CH4 molecule system via SystemBuilder s = SystemBuilder().from_name('CH4', sz=sz, npts=npts) # construct calculator object calculator = PyPWDFT(s) # perform self-consistent field procedure and store results in res object res = calculator.scf(tol=1e-1, verbose=True) if __name__ == '__main__': main() ``` -------------------------------- ### PeriodicSystem.get_r Source: https://ifilot.github.io/pypwdft/api.html Retrieves the sampling vectors in real-space. ```APIDOC ## PeriodicSystem.get_r ### Description Get the sampling vectors in real-space. ### Returns real-space sampling vectors ### Return type np.ndarray ``` -------------------------------- ### pypwdft.PyPWDFT methods Source: https://ifilot.github.io/pypwdft/genindex.html Methods available for the PyPWDFT class, used for performing DFT calculations. ```APIDOC ## __init__() PyPWDFT ### Description Initializes a PyPWDFT object. This is a constructor method. ### Method Constructor ### Parameters None explicitly documented. ### Response Initializes a PyPWDFT object. ``` ```APIDOC ## scf() PyPWDFT ### Description Performs a Self-Consistent Field (SCF) calculation. ### Method Method ### Parameters None explicitly documented. ### Response Returns the result of the SCF calculation. ``` -------------------------------- ### PeriodicSystem.calculate_vpot Source: https://ifilot.github.io/pypwdft/api.html Constructs the nuclear attraction potential in real-space, which is a key component in electronic structure calculations. ```APIDOC ## PeriodicSystem.calculate_vpot ### Description Construct the nuclear attraction potential. ### Returns nuclear attraction potential in real-space ### Return type np.ndarray ``` -------------------------------- ### Add Atoms to Periodic System Source: https://ifilot.github.io/pypwdft/usage.html Add atoms to a manually created PeriodicSystem by specifying their Cartesian coordinates and atomic charges. ```python # atomic positions atompos = np.array([[5.00000000, 5.00000000, 5.00000000], [6.19575624, 6.19575624, 6.19575624], [3.80424376, 3.80424376, 6.19575624], [3.80424376, 6.19575624, 3.80424376], [6.19575624, 3.80424376, 3.80424376]]) # atomic charges charges = [6, 1, 1, 1, 1] # C + 4 x H # add atoms to the system for p,c in zip(atompos, charges): s.add_atom(p[0], p[1], p[2], c) ``` -------------------------------- ### PyPWDFT.scf Source: https://ifilot.github.io/pypwdft/api.html Performs a self-consistent field (SCF) procedure to achieve electronic convergence for a given periodic system. It allows customization of the convergence criterion, the number of solutions, and verbosity. ```APIDOC ## PyPWDFT.scf ### Description Performs a self-consistent field procedure to achieve electronic convergence. ### Method `scf(_tol: float = 1e-05_, _nsol: int = None_, _verbose: bool = False_)` ### Parameters #### Optional Parameters - **tol** (float) - Electronic convergence criterion. Defaults to 1e-5. - **nsol** (int) - Number of solutions to find. Defaults to None. - **verbose** (bool) - Whether verbose output should be given. Defaults to False. ### Returns A dictionary containing system results. ### Return Type dict ``` -------------------------------- ### PyPWDFT.scf Source: https://ifilot.github.io/pypwdft/api.html Performs the Self-Consistent Field (SCF) calculation for the system. ```APIDOC ## PyPWDFT.scf ### Description Performs the Self-Consistent Field (SCF) calculation. ``` -------------------------------- ### PeriodicSystem.get_nelec Source: https://ifilot.github.io/pypwdft/api.html Retrieves the total number of electrons in the system. ```APIDOC ## PeriodicSystem.get_nelec ### Description Get the number of electrons. ### Returns number of electrons ### Return type int ``` -------------------------------- ### PeriodicSystem.get_pw_k Source: https://ifilot.github.io/pypwdft/api.html Retrieves the plane wave vectors used in the calculation. ```APIDOC ## PeriodicSystem.get_pw_k ### Description Get the plane wave vectors. ### Returns plane wave vectors ### Return type np.ndarray ``` -------------------------------- ### PeriodicSystem.get_pw_k2 Source: https://ifilot.github.io/pypwdft/api.html Retrieves the squared lengths of the plane wave vectors. ```APIDOC ## PeriodicSystem.get_pw_k2 ### Description Get the squared length of the plane wave vectors. ### Returns squared length of plane wave vectors ### Return type np.ndarray ``` -------------------------------- ### PeriodicSystem.get_omega Source: https://ifilot.github.io/pypwdft/api.html Retrieves the volume of the unit cell. ```APIDOC ## PeriodicSystem.get_omega ### Description Get unitcell volume. ### Returns volume of the unit cell ### Return type float ``` -------------------------------- ### PeriodicSystem.get_npts Source: https://ifilot.github.io/pypwdft/api.html Retrieves the number of sampling points per Cartesian direction in the unit cell grid. ```APIDOC ## PeriodicSystem.get_npts ### Description Get the number of sampling points per Cartesian direction. ### Returns number of sampling points per Cartesian direction ### Return type int ``` -------------------------------- ### PeriodicSystem.get_atom_charges Source: https://ifilot.github.io/pypwdft/api.html Retrieves the charges of all atoms currently added to the unit cell. ```APIDOC ## PeriodicSystem.get_atom_charges ### Description Get the atomic charges. ### Returns atomic charges ### Return type np.ndarray ``` -------------------------------- ### PeriodicSystem.get_atom_positions Source: https://ifilot.github.io/pypwdft/api.html Retrieves the positions of all atoms in the unit cell in real-space coordinates. ```APIDOC ## PeriodicSystem.get_atom_positions ### Description Get atomic positions in real-space. ### Returns atomic positions ### Return type np.ndarray ``` -------------------------------- ### PeriodicSystem.translate Source: https://ifilot.github.io/pypwdft/api.html Translates all atoms within the unit cell by a given displacement vector. ```APIDOC ## PeriodicSystem.translate ### Description Translate all atoms in unit cell. ### Parameters * **dist** (np.ndarray) – displacement vector ``` -------------------------------- ### PeriodicSystem.calculate_ewald_sum Source: https://ifilot.github.io/pypwdft/api.html Calculates the Ewald sum for the system, which is important for electrostatic interactions in periodic systems. It takes plane wave cutoff and separation parameters. ```APIDOC ## PeriodicSystem.calculate_ewald_sum ### Description Calculate Ewald sum. ### Parameters * **gcut** (float, optional) – Plane wave cut off energy in Ht. Defaults to 2. * **gamma** (float, optional) – Separation parameter. Defaults to 1e-8. ### Returns Ewald sum in Ht ### Return type float ``` -------------------------------- ### PeriodicSystem.get_r_norms Source: https://ifilot.github.io/pypwdft/api.html Retrieves the lengths of the real-space sampling vectors. ```APIDOC ## PeriodicSystem.get_r_norms ### Description Get real-space sampling vector lengths. ### Returns real-space sampling vector lengths ### Return type np.ndarray ``` -------------------------------- ### PeriodicSystem.add_atom Source: https://ifilot.github.io/pypwdft/api.html Adds an atom to the unit cell with specified coordinates, charge, and unit system. It supports both 'bohr' and 'angstrom' units. ```APIDOC ## PeriodicSystem.add_atom ### Description Add an atom to the unit cell. ### Parameters * **x** (float) – x-coordinate * **y** (float) – y-coordinate * **z** (float) – z-coordinate * **charge** (float) – charge of the atom * **unit** (str, optional) – Which length unit, ‘bohr’ or ‘angstrom’. Defaults to ‘bohr’. ### Raises **Exception** – Invalid unit received. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.