### Example geometry file with one-based atom indices Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/notes.rst Shows a sample geometry file (likely .gjf or .xyz) where atoms are indexed starting from 1. The comment lines indicate the atom index for each atom. ```none 14 PdPMe3 Pd -0.743397 -0.000992 -1.518770 # Atom with index 1 P 1.005896 0.002102 -0.163618 # Atom with index 2 ... ``` -------------------------------- ### Install xtb-python Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Installs xtb-python, required for xTB optimization within QCEngine. Note that xtb-python is deprecated; Mᴏʀғᴇᴜs now uses the command-line for xTB electronic descriptors. ```shell conda install -c conda-forge xtb-python ``` -------------------------------- ### Install PyBerny and geomeTRIC Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Installs PyBerny or geomeTRIC, required for optimization through QCEngine. geomeTRIC can be installed with pip or conda. ```shell pip install pyberny pip install geometric conda install -c conda-forge geometric ``` -------------------------------- ### Calculate solvation properties with XTB Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/xtb.rst Initialize XTB with a solvent (water) and retrieve solvation energy and hydrogen bond correction in kcal/mol. The example shows sample outputs. ```python >>> xtb = XTB(elements, coordinates, solvent="water") >>> xtb.get_solvation_energy(unit="kcal/mol") -4.644374184273 >>> xtb.get_solvation_h_bond_correction(unit="kcal/mol") -2.808641396951 ``` -------------------------------- ### Install morfeus with pip Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/index.rst Install morfeus using pip from PyPI. ```shell $ pip install morfeus-ml ``` -------------------------------- ### Calculate electronic properties with XTB Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/xtb.rst Initialize XTB with elements and coordinates from an XYZ file, then retrieve bond order, charges, energy, HOMO, dipole, ionization potential (with and without correction), and electron affinity. The example uses ammonia.xyz and shows sample outputs. ```python >>> from morfeus import XTB, read_xyz >>> elements, coordinates = read_xyz("ammonia.xyz") >>> xtb = XTB(elements, coordinates) >>> xtb.get_bond_order(1, 2) 0.978270297857 >>> xtb.get_charges() {1: -0.4344091, 2: 0.14479795, 3: 0.14480895, 4: 0.1448022} >>> xtb.get_energy() -4.42584832 >>> xtb.get_homo() -0.3847857 >>> xtb.get_dipole() array([ 0.38617738, 0.48077917, -0.31171428]) >>> xtb.get_ip() 11.6047 >>> xtb.get_ip(corrected=False) 16.4502 >>> xtb.get_ea() -11.121 ``` -------------------------------- ### Install MKL BLAS implementation with conda Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/installation.rst Switch the BLAS implementation to MKL on Linux or Windows, which often works better than OpenBLAS, especially when using xtb. ```shell conda install "libblas=*=*mkl" ``` -------------------------------- ### Set MPLBACKEND environment variable Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/notes.rst Alternative to the Python backend setting: set the MPLBACKEND environment variable in the shell before launching the script. Example shown for Linux. ```shell export MPLBACKEND="agg" ``` -------------------------------- ### Generate and process conformers with RDKit Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Generate conformers for n-pentane using RDKit with MMFF94 optimization, then prune by RMSD, sort by energy, and write an XYZ file. The example shows 13 conformers initially, reduced to 8 after pruning, and relative energies in kcal/mol. ```python >>> from morfeus.conformer import ConformerEnsemble >>> ce = ConformerEnsemble.from_rdkit("CCCCC", optimize="MMFF94") >>> ce ConformerEnsemble(13 conformers) >>> ce.prune_rmsd() ConformerEnsemble(8 conformers) >>> ce.sort() >>> ce.get_relative_energies() array([0. , 0.82991425, 0.82991425, 0.82991425, 0.82991425, 1.42317077, 1.42317077, 3.70003054]) >>> ce.write_xyz("conformers.xyz") ``` -------------------------------- ### Install RDKit and OpenBabel with conda Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Install RDKit and OpenBabel via conda-forge, which are required for generating conformers from SMILES strings. ```shell conda install -c conda-forge rdkit conda install -c conda-forge openbabel ``` -------------------------------- ### Optimize with RDKit and MMFF94 Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Optimizes a conformer ensemble with RDKit using the MMFF94 force field and the geometric procedure. The example shows relative energies before and after optimization. ```python >>> ce = ConformerEnsemble.from_rdkit("CCCC", optimize="MMFF94") >>> ce.prune_rmsd() >>> ce.sort() >>> ce.get_relative_energies() array([0. , 0.78220907, 0.78220907]) # Optimize with MMF94 >>> ce.optimize_qc_engine(program="rdkit", model={"method": "MMFF94"}, procedure="geometric") >>> ce.get_relative_energies() array([0. , 0.18695245, 0.18695245])) ``` -------------------------------- ### Parse CREST output with ConformerEnsemble.from_crest Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Parses CREST output from a folder containing crest_conformers.xyz, cre_members, and crest.eneriges. The example shows sorting, relative energies, degeneracies, and Boltzmann weights; the second block is the printed table from the ensemble's __repr__. ```python >>> ce = ce = ConformerEnsemble.from_crest("crest_output_folder") >>> ce ConformerEnsemble(8 conformers) >>> ce.sort() >>> ce.get_relative_energies() array([0. , 0.468, 0.829, 0.832, 0.834]) >>> ce.get_degeneracies() array([ 4, 27, 8, 2, 1]) >>> ce.boltzmann_weights() array([0.45642055, 0.20716615, 0.11264294, 0.11207402, 0.11169634]) ``` ```none Erel/kcal Etot weight/tot conformer set degen origin 1 0.000 -2.40317 0.05283 0.21084 1 4 mtd3 2 0.000 -2.40317 0.05281 mtd4 3 0.002 -2.40317 0.05262 mtd3 4 0.003 -2.40316 0.05258 mtd4 5 0.468 -2.40242 0.02400 0.64605 2 27 mtd2 6 0.468 -2.40242 0.02399 mtd4 7 0.468 -2.40242 0.02398 mtd6 8 0.468 -2.40242 0.02398 mtd1 9 0.469 -2.40242 0.02398 mtd1 10 0.469 -2.40242 0.02398 mtd1 11 0.469 -2.40242 0.02397 mtd2 12 0.469 -2.40242 0.02397 mtd1 13 0.469 -2.40242 0.02397 mtd3 14 0.469 -2.40242 0.02396 mtd1 15 0.469 -2.40242 0.02395 mtd1 16 0.469 -2.40242 0.02395 mtd4 17 0.469 -2.40242 0.02394 mtd4 18 0.469 -2.40242 0.02394 mtd5 19 0.469 -2.40242 0.02394 mtd3 20 0.470 -2.40242 0.02393 mtd1 21 0.470 -2.40242 0.02393 mtd1 22 0.470 -2.40242 0.02391 mtd3 23 0.470 -2.40242 0.02391 mtd5 24 0.470 -2.40242 0.02390 mtd5 25 0.471 -2.40242 0.02389 mtd2 26 0.471 -2.40242 0.02388 mtd1 27 0.471 -2.40242 0.02387 mtd3 28 0.472 -2.40242 0.02386 mtd3 29 0.472 -2.40242 0.02385 mtd5 30 0.473 -2.40242 0.02381 mtd3 31 0.473 -2.40242 0.02381 mtd6 32 0.829 -2.40185 0.01306 0.10429 3 8 mtd3 33 0.829 -2.40185 0.01305 mtd2 34 0.829 -2.40185 0.01305 mtd6 35 0.829 -2.40185 0.01305 mtd2 36 0.829 -2.40185 0.01305 mtd2 37 0.830 -2.40185 0.01304 mtd5 38 0.832 -2.40184 0.01300 mtd5 39 0.832 -2.40184 0.01299 mtd5 40 0.832 -2.40184 0.01299 0.02588 4 2 mtd3 41 0.837 -2.40184 0.01289 mtd3 42 0.834 -2.40184 0.01295 0.01295 5 1 mtd5 ``` -------------------------------- ### ConeAngle class usage example Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/cone_angle.rst Shows how to use the ConeAngle class to calculate the cone angle of a ligand from an XYZ file. The central atom index is 1-indexed and corresponds to the metal atom (Pd in the example). The example prints the cone angle, tangent atoms, a formatted report, and draws a 3D visualization. ```python >>> from morfeus import ConeAngle, read_xyz >>> elements, coordinates = read_xyz("phosphines/PdPMe3.xyz") >>> cone_angle = ConeAngle(elements, coordinates, 1) >>> print(cone_angle.cone_angle) 117.11012922937584 >>> print(cone_angle.tangent_atoms) [5, 9, 12] >>> cone_angle.print_report() Cone angle: 117.1 No. tangent atoms: 3 >>> cone_angle.draw_3D() ``` -------------------------------- ### Calculate conceptual DFT descriptors with XTB Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/xtb.rst Retrieve global and local descriptors from conceptual density functional theory using get_global_descriptor and get_fukui. The example shows electrophilicity and nucleophilicity values for the same ammonia system. ```python >>> xtb.get_global_descriptor("electrophilicity") 0.0012869003485041107 >>> xtb.get_global_descriptor("nucleophilicity") -11.6047 >>> xtb.get_fukui("electrophilicity") {1: 0.205, 2: 0.265, 3: 0.265, 4: 0.265} >>> xtb.get_fukui("nucleophilicity") {1: 0.428, 2: 0.191, 3: 0.191, 4: 0.191} ``` -------------------------------- ### Use '--' to pass arguments to Fire Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/cli.rst Shows how to use the '--' separator to send arguments directly to the Fire program. In this example, '--help' is sent to Python Fire instead of the Sterimol object. ```shell $ morfeus sterimol tBu.xyz - -- --help ``` -------------------------------- ### Run morfeus xtb to get charges Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/xtb.rst Runs the morfeus command line script to calculate charges for ammonia.xyz using the default method. The output shows the resulting charge value. ```shell $ morfeus xtb ammonia.xyz - - get_charges - 1 -0.4344091 ``` -------------------------------- ### Run morfeus xtb with method 1 to get charges Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/xtb.rst Runs the morfeus command line script to calculate charges for ammonia.xyz with method 1 specified. The output shows the resulting charge value. ```shell $ morfeus xtb ammonia.xyz - --method='"1"' - get_charges - 1 -0.57697413 ``` -------------------------------- ### Prune conformers with RMSD and energy Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Prunes conformers by RMSD using the obrms-batch method and then prunes by energy with the default threshold of 3 kcal/mol. The example shows the relative energies before and after energy pruning. ```python >>> ce = ConformerEnsemble.from_rdkit("C1CCCCC1", optimize="MMFF94") >>> ce.prune_rmsd(method="obrms-batch") >>> ce.sort() >>> ce.get_relative_energies() array([0. , 5.9297458]) >>> ce.prune_energy() >>> ce.get_relative_energies() array([0.]) ``` -------------------------------- ### Fire interactive mode for Sterimol result Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/cli.rst Uses the Fire --interactive flag to start a Python REPL with the result object. Shows how to inspect the Sterimol object, access its bond_length, print a report, and call draw_3D for 3D visualization. ```shell $ morfeus sterimol tBu.xyz - 1 2 - -- --interactive Fire is starting a Python REPL with the following objects: Modules: fire Objects: component, main, morfeus, result, trace Python 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:20) Type 'copyright', 'credits' or 'license' for more information IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: result Out[1]: Sterimol(14 atoms) In [2]: result.bond_length Out[2]: 1.1 In [3]: result.print_report() L B_1 B_5 4.21 2.86 3.27 In [4]: result.draw_3D() ... ``` -------------------------------- ### UniMoVib input for generating umv and local files Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst UniMoVib input file that generates the umv and local files. The qcprog keyword specifies the quantum-chemical program (here Gaussian), iflocal=.t. enables local mode calculations, and ifsave=.t. saves the output files. The fchk keyword points to the Gaussian checkpoint file. ```none a test job $contrl qcprog="gaussian" iflocal=.t. ifsave=.t. $end $qcdata fchk="freq.fchk" $end ``` -------------------------------- ### Install morfeus with conda Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/index.rst Install morfeus using conda from the conda-forge channel. ```shell $ conda install -c conda-forge morfeus-ml ``` -------------------------------- ### morfeus sterimol fully instantiated help Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/cli.rst Shows the help for a fully instantiated Sterimol object, listing available commands and value attributes. ```shell $ morfeus sterimol tBu.xyz - 1 2 --radii_type=bondi - -- --help ``` ```none NAME morfeus sterimol tBu.xyz 1 2 --radii_type=bondi - Performs and stores results of Sterimol calculation. SYNOPSIS morfeus sterimol tBu.xyz - 1 2 --radii_type=bondi - COMMAND | VALUE DESCRIPTION Performs and stores results of Sterimol calculation. COMMANDS COMMAND is one of the following: bury Do a Buried Sterimol calculation. calculate Calculate Sterimol parameters. draw_3D Draw a 3D representation of the molecule with the Sterimol vectors. print_report Prints the values of the Sterimol parameters. set_points Set points for calculation of Sterimol. surface_from_radii Create surface points from vdW surface. VALUES VALUE is one of the following: B_1 B_1_value B_5 B_5_value L L_value L_value_uncorrected bond_length ``` -------------------------------- ### LocalForce - Load Gaussian log file and compute local force constants Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Demonstrates loading a Gaussian log file, computing local force constants and frequencies, and retrieving a specific local force constant and frequency. ```APIDOC ## LocalForce - Load Gaussian log file and compute local force constants ### Description Loads a Gaussian log file, computes local force constants and frequencies, and retrieves a specific local force constant and frequency. ### Usage ```python from morfeus import LocalForce lf = LocalForce() lf.load_file("freq-lm.log", "gaussian", "log") lf.compute_local() lf.compute_frequencies() fc = lf.get_local_force_constant([1, 2]) print(fc) # 5.364289643211871 freq = lf.get_local_frequency([1, 2]) print(freq) # 3129.3126301763527 ``` ### Methods - **load_file(file, program, filetype)** - Loads Hessian data from a file. Parameters: file (str), program (str), filetype (str). - **compute_local()** - Computes local force constants. - **compute_frequencies()** - Computes frequencies. - **get_local_force_constant(atom_indices)** - Returns the local force constant for the given atom indices. - **get_local_frequency(atom_indices)** - Returns the local frequency for the given atom indices. ``` -------------------------------- ### LocalForce - Add internal coordinates and compute local force constants Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Demonstrates loading a unimovib log file, adding custom internal coordinates, computing local force constants and frequencies, and printing a report. ```APIDOC ## LocalForce - Add internal coordinates and compute local force constants ### Description Loads a unimovib log file, adds custom internal coordinates, computes local force constants and frequencies, and prints a report. ### Usage ```python from morfeus import LocalForce lf = LocalForce() lf.load_file("job.out", "unimovib", "log") lf.add_internal_coordinate([1, 2]) lf.add_internal_coordinate([1, 2, 3]) print(lf.internal_coordinates) # [Bond(1, 2), Angle(1, 2, 3)] lf.compute_local() lf.compute_frequencies() fc = lf.get_local_force_constant([1, 2]) print(fc) # 5.364347084281298 freq = lf.get_local_frequency([1, 2]) print(freq) # 3129.337947449028 lf.print_report(angles=True, angle_units=True) # Coordinate Force constant (mDyne/Å, mDyne Å rad^(-2)) Frequency (cm^-1) # Bond(1, 2) 5.364 3129 # Angle(1, 2, 3) 2.416 1687 ``` ### Methods - **load_file(file, program, filetype)** - Loads Hessian data from a file. Parameters: file (str), program (str), filetype (str). - **add_internal_coordinate(atom_indices)** - Adds an internal coordinate defined by the given atom indices. - **compute_local()** - Computes local force constants. - **compute_frequencies()** - Computes frequencies. - **get_local_force_constant(atom_indices)** - Returns the local force constant for the given atom indices. - **get_local_frequency(atom_indices)** - Returns the local frequency for the given atom indices. - **print_report(angles=False, angle_units=False)** - Prints a report of force constants and frequencies. Parameters: angles (bool), angle_units (bool). ``` -------------------------------- ### Run solid_angle command line script Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/solid_angle.rst Shows how to use the command line script to calculate and print the solid angle, cone angle, and G parameter for a given structure. The output is shown after the command. ```shell $ morfeus solid_angle PdPMe3.xyz - 1 - print_report Solid angle (sr): 2.794 Cone angle (°): 112.536 G: 22.235 ``` -------------------------------- ### Optimize and single-point with QCEngine and xtb Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Optimizes a conformer ensemble with GFN-FF using the xtb program and geometric procedure, then performs single-point calculations with GFN2-xTB. Requires xtb-python and either PyBerny or geomeTRIC. ```python >>> ce = ConformerEnsemble.from_rdkit("CCCC", optimize="MMFF94") >>> ce.prune_rmsd() >>> ce.sort() >>> ce.get_relative_energies() array([0. , 0.78220907, 0.78220907]) # Optimize with GFN-FF >>> model={"method": "GFN-FF"} >>> ce.optimize_qc_engine(program="xtb", model=model, procedure="geometric") >>> ce.get_relative_energies() array([0. , 0.45271867, 0.45271867]) # Do single points with GFN2-xTB >>> model={"method": "GFN2-xTB"} >>> ce.sp_qc_engine(program="xtb", model=model) >>> ce.get_relative_energies() array([0. , 0.63087431, 0.6308743 ]) ``` -------------------------------- ### LocalForce - Load xtb Hessian and compute local force constants Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Demonstrates loading an xtb Hessian file, performing normal mode analysis, detecting bonds, computing local force constants and frequencies, and retrieving a specific local force constant and frequency. ```APIDOC ## LocalForce - Load xtb Hessian and compute local force constants ### Description Loads an xtb Hessian file, performs normal mode analysis, detects bonds, computes local force constants and frequencies, and retrieves a specific local force constant and frequency. ### Usage ```python from morfeus import LocalForce, read_xyz elements, coordinates = read_xyz("xtbopt.xyz") lf = LocalForce(elements, coordinates) lf.load_file("hessian", "xtb", "hessian") lf.normal_mode_analysis() lf.detect_bonds() print(lf.internal_coordinates) # [Bond(1, 4), Bond(1, 3), Bond(1, 2), Bond(1, 5)] lf.compute_local() lf.compute_frequencies() fc = lf.get_local_force_constant([1, 2]) print(fc) # 5.190222259808879 freq = lf.get_local_frequency([1, 2]) print(freq) # 3078.130379468432 ``` ### Methods - **LocalForce(elements, coordinates)** - Constructor with optional elements and coordinates. - **load_file(file, program, filetype)** - Loads Hessian data from a file. Parameters: file (str), program (str), filetype (str). - **normal_mode_analysis()** - Performs normal mode analysis. - **detect_bonds()** - Detects bonds and populates internal coordinates. - **compute_local()** - Computes local force constants. - **compute_frequencies()** - Computes frequencies. - **get_local_force_constant(atom_indices)** - Returns the local force constant for the given atom indices. - **get_local_frequency(atom_indices)** - Returns the local frequency for the given atom indices. ``` -------------------------------- ### LocalForce - Load unimovib log file and compute local force constants Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Demonstrates loading a unimovib log file, detecting bonds, computing local force constants and frequencies, and retrieving a specific local force constant and frequency. ```APIDOC ## LocalForce - Load unimovib log file and compute local force constants ### Description Loads a unimovib log file, detects bonds, computes local force constants and frequencies, and retrieves a specific local force constant and frequency. ### Usage ```python from morfeus import LocalForce lf = LocalForce() lf.load_file("job.out", "unimovib", "log") lf.detect_bonds() lf.compute_local() lf.compute_frequencies() fc = lf.get_local_force_constant([1, 2]) print(fc) # 5.364347084281302 freq = lf.get_local_frequency([1, 2]) print(freq) # 3129.337947449028 ``` ### Methods - **load_file(file, program, filetype)** - Loads Hessian data from a file. Parameters: file (str), program (str), filetype (str). - **detect_bonds()** - Detects bonds and populates internal coordinates. - **compute_local()** - Computes local force constants. - **compute_frequencies()** - Computes frequencies. - **get_local_force_constant(atom_indices)** - Returns the local force constant for the given atom indices. - **get_local_frequency(atom_indices)** - Returns the local frequency for the given atom indices. ``` -------------------------------- ### morfeus sterimol partial object help Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/cli.rst Shows the help for a partially instantiated Sterimol object, revealing required arguments `dummy_index` and `attached_index` and available flags. ```shell $ morfeus sterimol tBu.xyz - -- --help ``` ```none NAME morfeus sterimol tBu.xyz - partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. SYNOPSIS morfeus sterimol tBu.xyz - GROUP | COMMAND | --dummy_index=DUMMY_INDEX --attached_index=ATTACHED_INDEX DESCRIPTION partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. ARGUMENTS DUMMY_INDEX Type: int ATTACHED_INDEX Type: typing.Union[int, ... FLAGS --radii=RADII Type: Optional[typing.Union[int, float, complex, str, bytes, numpy.ge... Default: None --radii_type=RADII_TYPE Type: str Default: 'crc' --n_rot_vectors=N_ROT_VECTORS Type: int Default: 3600 --excluded_atoms=EXCLUDED_ATOMS Type: Optional[t... Default: None --calculate=CALCULATE Type: bool Default: True GROUPS GROUP is one of the following: args keywords COMMANDS COMMAND is one of the following: func Performs and stores results of Sterimol calculation. ``` -------------------------------- ### LocalForce - Load Gaussian fchk file and compute local force constants Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Demonstrates loading a Gaussian fchk file, computing local force constants and frequencies, and retrieving a specific local force constant and frequency. ```APIDOC ## LocalForce - Load Gaussian fchk file and compute local force constants ### Description Loads a Gaussian fchk file, computes local force constants and frequencies, and retrieves a specific local force constant and frequency. ### Usage ```python from morfeus import LocalForce lf = LocalForce() lf.load_file("freq.fchk", "gaussian", "fchk") lf.compute_compliance() lf.compute_frequencies() fc = lf.get_local_force_constant([1, 2]) print(fc) # 5.364398642985929 freq = lf.get_local_frequency([1, 2]) print(freq) # 3129.352986019491 ``` ### Methods - **load_file(file, program, filetype)** - Loads Hessian data from a file. Parameters: file (str), program (str), filetype (str). - **compute_compliance()** - Computes compliance matrix. - **compute_frequencies()** - Computes frequencies. - **get_local_force_constant(atom_indices)** - Returns the local force constant for the given atom indices. - **get_local_frequency(atom_indices)** - Returns the local frequency for the given atom indices. ``` -------------------------------- ### Convert atom_areas dictionary to list Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/notes.rst Demonstrates how to read a geometry file and compute SASA, then shows that atom_areas is a dictionary keyed by one-based atom indices. Use list(sasa.atom_areas.values()) to get a zero-indexed list. ```python >>> from morfeus import SASA, read_geometry >>> elements, coordinates = read_geometry("Et.gjf") >>> sasa = SASA(elements, coordinates) >>> sasa.atom_areas {1: 22.489947408719903, 2: 19.180448148100027, 3: 22.529947315182724, ... >>> list(sasa.atom_areas.values()) [22.489947408719903, 19.180448148100027, 22.529947315182724, ... ``` -------------------------------- ### Load xtb hessian file and compute local force constants and frequencies Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Loads an xtb hessian file ('hessian') using the 'xtb' format and 'hessian' file type, performs normal mode analysis and bond detection, then computes local modes and frequencies. The detected internal coordinates are printed, and the local force constant and frequency for the bond between atoms 1 and 2 are retrieved. Output values are shown. ```python >>> from morfeus import LocalForce, read_xyz >>> elements, coordinates = read_xyz("xtbopt.xyz") >>> lf = LocalForce(elements, coordinates) >>> lf.load_file("hessian", "xtb", "hessian") >>> lf.normal_mode_analysis() >>> lf.detect_bonds() >>> print(lf.internal_coordinates) [Bond(1, 4), Bond(1, 3), Bond(1, 2), Bond(1, 5)] >>> lf.compute_local() >>> lf.compute_frequencies() >>> fc = lf.get_local_force_constant([1, 2]) >>> print(fc) 5.190222259808879 >>> freq = lf.get_local_frequency([1, 2]) >>> print(freq) 3078.130379468432 ``` -------------------------------- ### Load unimovib log file and compute local force constants and frequencies Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Loads a unimovib log file ('job.out') using the 'unimovib' format and 'log' file type, detects bonds, then computes local modes and frequencies. The local force constant and frequency for the bond between atoms 1 and 2 are retrieved. Output values are shown. ```python >>> from morfeus import LocalForce >>> lf = LocalForce() >>> lf.load_file("job.out", "unimovib", "log") >>> lf.detect_bonds() >>> lf.compute_local() >>> lf.compute_frequencies() >>> fc = lf.get_local_force_constant([1, 2]) >>> print(fc) 5.364347084281302 >>> freq = lf.get_local_frequency([1, 2]) >>> print(freq) 3129.337947449028 ``` -------------------------------- ### Calculate exact ligand cone angle with Python API Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/index.rst Import morfeus and use the ConeAngle class to compute the exact ligand cone angle from an XYZ file. The example prints the cone angle value. ```python >>> from morfeus import ConeAngle, read_xyz >>> elements, coordinates = read_xyz("PdPMe3.xyz") >>> cone_angle = ConeAngle(elements, coordinates, 1) >>> print(cone_angle.cone_angle) 117.11012922937584 ``` -------------------------------- ### Generate conformers with OpenBabel GA Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Generate conformers for n-pentane using the OpenBabel genetic algorithm (GA) method. The resulting ensemble contains 7 conformers. ```python >>> ce = ConformerEnsemble.from_ob_ga("CCCCC") >>> ce ConformerEnsemble(7 conformers) ``` -------------------------------- ### ConformerEnsemble.optimize_qc_engine Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Optimizes conformer geometries using QCEngine with a specified program and model. Requires additional dependencies like PyBerny or geomeTRIC for optimization. ```APIDOC ## [METHOD] ConformerEnsemble.optimize_qc_engine ### Description Optimizes the geometry of conformers using QCEngine. The `program`, `model`, `keywords`, and `local_options` arguments are passed directly to QCEngine. Requires installation of PyBerny or geomeTRIC for optimization, and xtb-python for xTB methods. ### Method METHOD ### Endpoint ConformerEnsemble.optimize_qc_engine ### Parameters #### Keyword Arguments - **program** (str) - Required - The QCEngine program to use (e.g., 'xtb', 'rdkit'). - **model** (dict) - Required - Dictionary specifying the model, e.g., {"method": "GFN-FF"} or {"method": "MMFF94"}. - **keywords** (dict) - Optional - Additional keywords passed to QCEngine. - **local_options** (dict) - Optional - Local options for QCEngine. - **procedure** (str) - Optional - Optimization procedure (e.g., 'geometric'). Default: 'geometric'. ### Request Example ```python ce.optimize_qc_engine(program="xtb", model={"method": "GFN-FF"}, procedure="geometric") ce.optimize_qc_engine(program="rdkit", model={"method": "MMFF94"}, procedure="geometric") ``` ### Response #### Success Response (200) No explicit response body; method modifies the ConformerEnsemble in-place. #### Response Example No response body. ### Error Handling - Requires PyBerny or geomeTRIC installed; otherwise, an error is raised. - For xTB, requires xtb-python installed (deprecated, but still works). ``` -------------------------------- ### Calculate buried volume with BuriedVolume Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/buried_volume.rst Basic usage of the BuriedVolume class to compute the fraction of buried volume and print a report. The atom index 1 is the central atom (Ni in the example). By default, hydrogen atoms are excluded; other ligand atoms must be listed in excluded_atoms. ```python >>> from morfeus import BuriedVolume, read_xyz >>> elements, coordinates = read_xyz("1.xyz") >>> bv = BuriedVolume(elements, coordinates, 1, excluded_atoms=[2, 3, 4, 5, 6, 7]) >>> print(bv.fraction_buried_volume) 0.2962110976518822 >>> bv.print_report() V_bur (%): 29.6 ``` -------------------------------- ### Calculate bite angle with BiteAngle class Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/bite_angle.rst Basic usage of the BiteAngle class: read an XYZ file, create a BiteAngle object with the metal atom index (1) and coordinating atom indices (2 and 3), and access the angle attribute. The example prints the angle for bpy.xyz. ```python >>> from morfeus import BiteAngle, read_xyz >>> elements, coordinates = read_xyz("bpy.xyz") >>> ba = BiteAngle(coordinates, 1, 2, 3) >>> ba.angle 77.29254645757716 ``` -------------------------------- ### Calculate dispersion with D4 coefficients from dftd4 program Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/dispersion.rst Computes dispersion coefficients using the D4 model via the dftd4 program. Requires the dftd4 python package installed in the same environment. The model is specified as "gd4" and the output shows the resulting surface area, volume, and P_int. ```python >>> elements, coordinates = read_xyz("pme3.xyz") >>> disp = Dispersion(elements, coordinates, compute_coefficients=False) >>> disp.compute_coefficients(model="gd4") >>> disp.compute_p_int() >>> disp.print_report() Surface area (Ų): 178.4 Surface volume (ų): 157.8 P_int (kcal¹ᐟ² mol⁻¹ᐟ²): 20.1 ``` -------------------------------- ### Run pyramidalization from command line Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/pyramidalization.rst Command-line usage of the pyramidalization functionality. The command takes the geometry file, atom index, and print_report flag; output shows the P and P_angle values. ```shell $ morfeus pyramidalization pyr.xyz - 1 - print_report P: 0.938 P_angle: 7.579 ``` -------------------------------- ### Load Gaussian log file and compute local force constants and frequencies Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Loads a Gaussian log file ('freq-lm.log') using the 'gaussian' format and 'log' file type, computes local modes and frequencies, then retrieves the local force constant and frequency for the bond between atoms 1 and 2. Output values are shown. ```python >>> from morfeus import LocalForce >>> lf = LocalForce() >>> lf.load_file("freq-lm.log", "gaussian", "log") >>> lf.compute_local() >>> lf.compute_frequencies() >>> fc = lf.get_local_force_constant([1, 2]) >>> print(fc) 5.364289643211871 >>> freq = lf.get_local_frequency([1, 2]) >>> print(freq) 3129.3126301763527 ``` -------------------------------- ### Run buried volume calculation with morfeus CLI Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/buried_volume.rst Invokes the morfeus command line script to calculate the percent of buried volume for a given structure file. The example uses the file '1.xyz', specifies the metal atom index as 1, and excludes atoms 2 through 7. The output is the percent buried volume, shown as 'V_bur (%): 29.6'. ```shell $ morfeus buried_volume 1.xyz - 1 --excluded_atoms='[2,3,4,5,6,7]' - print_report V_bur (%): 29.6 ``` -------------------------------- ### Load Gaussian fchk file and compute local force constants and frequencies Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Loads a Gaussian formatted checkpoint file ('freq.fchk') using the 'gaussian' format and 'fchk' file type, computes compliance matrix and frequencies, then retrieves the local force constant and frequency for the bond between atoms 1 and 2. Output values are shown. ```python >>> from morfeus import LocalForce >>> lf = LocalForce() >>> lf.load_file("freq.fchk", "gaussian", "fchk") >>> lf.compute_compliance() >>> lf.compute_frequencies() >>> fc = lf.get_local_force_constant([1, 2]) >>> print(fc) 5.364398642985929 >>> freq = lf.get_local_frequency([1, 2]) >>> print(freq) 3129.352986019491 ``` -------------------------------- ### Calculate inverted bite angle with ref_atoms Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/bite_angle.rst Usage of BiteAngle with a reference vector constructed from ref_atoms to handle inverted bite angles (angles beyond 180°). The example uses bpy_inverted.xyz, with metal atom index 1, coordinating atoms 2 and 3, and reference atoms 4 and 17. The angle is 198.39710046622645 and the inverted attribute is True. ```python >>> elements, coordinates = read_xyz("bpy_inverted.xyz") >>> ba = BiteAngle(coordinates, 1, 2, 3, ref_atoms=[4, 17]) >>> ba.angle 198.39710046622645 >>> ba.inverted True ``` -------------------------------- ### ConformerEnsemble.from_crest Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Parses CREST output files from a specified folder into a ConformerEnsemble object. Requires the files crest_conformers.xyz, cre_members, and crest.eneriges to be present in the output folder. ```APIDOC ## [CLASS_METHOD] ConformerEnsemble.from_crest ### Description Parses CREST output files from a specified folder into a ConformerEnsemble object. The required files are crest_conformers.xyz, cre_members, and crest.eneriges. ### Method Class method ### Endpoint ConformerEnsemble.from_crest(folder) ### Parameters #### Path Parameters - **folder** (str) - Required - Path to the folder containing CREST output files. ### Request Example ```python >>> ce = ConformerEnsemble.from_crest("crest_output_folder") ``` ### Response #### Success Response - **ConformerEnsemble** - An ensemble object containing the parsed conformers. #### Response Example ```python ConformerEnsemble(8 conformers) ``` ``` -------------------------------- ### Add internal coordinates manually and compute local force constants and frequencies Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/local_force.rst Loads a unimovib log file ('job.out'), adds a bond (1,2) and an angle (1,2,3) as internal coordinates, then computes local modes and frequencies. The local force constant and frequency for the bond are retrieved, and a report is printed with angles and angle units. Output values and report are shown. ```python >>> from morfeus import LocalForce >>> lf = LocalForce() >>> lf.load_file("job.out", "unimovib", "log") >>> lf.add_internal_coordinate([1, 2]) >>> lf.add_internal_coordinate([1, 2, 3]) >>> print(lf.internal_coordinates) [Bond(1, 2), Angle(1, 2, 3)] >>> lf.compute_local() >>> lf.compute_frequencies() >>> fc = lf.get_local_force_constant([1, 2]) >>> print(fc) 5.364347084281298 >>> freq = lf.get_local_frequency([1, 2]) >>> print(freq) 3129.337947449028 >>> lf.print_report(angles=True, angle_units=True) Coordinate Force constant (mDyne/Å, mDyne Å rad^(-2)) Frequency (cm^-1) Bond(1, 2) 5.364 3129 Angle(1, 2, 3) 2.416 1687 ``` -------------------------------- ### morfeus CLI help Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/cli.rst Running the `morfeus` command without arguments displays the help page listing all available subcommands. ```shell $ morfeus ``` ```none NAME morfeus SYNOPSIS morfeus COMMAND COMMANDS COMMAND is one of the following: buried_volume CLI for buried volume. cone_angle CLI for cone angle. conformer CLI for cone angle. dispersion CLI for dispersion descriptor. local_force CLI for local force. pyramidalization CLI for pyramidalization. sasa CLI for solvent accessible surface area. sterimol CLI for Sterimol. visible_volume CLI for visible volume. xtb CLI for XTB. ``` -------------------------------- ### Handle enantiomeric conformers with ConformerEnsemble Source: https://github.com/digital-chemistry-laboratory/morfeus/blob/main/docs/conformer.rst Demonstrates handling conformational enantiomers with diethyl ether. The workflow adds inverted conformers, prunes duplicates, condenses enantiomers, and reports degeneracies and relative energies. ```python >>> ce = ConformerEnsemble.from_rdkit("CCOCC", optimize="MMFF94") >>> ce ConformerEnsemble(12 conformers) >>> ce.prune_rmsd() ConformerEnsemble(7 conformers) >>> ce.add_inverted() # Invert conformers to add potentially missing enantiomers ConformerEnsemble(14 conformers) >>> ce.prune_rmsd() # Prune out all duplicates added in previous step ConformerEnsemble(7 conformers) >>> ce.condense_enantiomeric() # Condense enantiomers to single conformer ConformerEnsemble(4 conformers) >>> ce.sort() >>> ce.get_degeneracies() array([1, 2, 2, 2]) >>> ce.get_relative_energies() array([0. , 1.51922335, 1.51922335, 3.03207887]) ```