### Install SCINE Parrot using pip Source: https://github.com/qcscine/parrot/blob/main/README.rst This command clones the SCINE Parrot repository and then installs the package using pip. It's a standard method for installing Python packages from source. Ensure you have git and pip installed. ```bash git clone pip install ./parrot ``` -------------------------------- ### Build SCINE Parrot documentation locally Source: https://github.com/qcscine/parrot/blob/main/README.rst These commands navigate to the Parrot directory and use 'make' to build the HTML documentation. This requires the 'requirements-dev.txt' file to be installed first. The documentation will be available in the 'docs/build/html/' directory. ```bash cd parrot make -C docs html ``` -------------------------------- ### Install development requirements for SCINE Parrot documentation Source: https://github.com/qcscine/parrot/blob/main/README.rst This command installs the necessary Python packages listed in 'requirements-dev.txt' to build the SCINE Parrot documentation. It should be run from the root of the cloned repository. ```bash cd parrot pip install -r requirements-dev.txt ``` -------------------------------- ### Load and Announce SCINE Parrot Module Source: https://context7.com/qcscine/parrot/llms.txt Demonstrates how to load the ParrotModule into the SCINE module manager and list available calculator interfaces and models. It requires the 'scine_utilities' and 'scine_parrot.module' libraries. ```python import scine_utilities as utils from scine_parrot.module import ParrotModule # Get the module manager singleton and load Parrot module_manager = utils.core.ModuleManager.get_instance() module_manager.load_module(ParrotModule()) # Check if module is loaded assert module_manager.module_loaded('Parrot') # List available calculator interfaces parrot = ParrotModule() interfaces = parrot.announceInterfaces() # Returns ['calculator'] models = parrot.announceModels('calculator') # Returns ['LMLP', 'ANI', 'M3GNET', 'MACE'] # Get a specific calculator by name calculator = module_manager.get('calculator', 'lmlp') # or 'ani', 'm3gnet', 'mace' ``` -------------------------------- ### Predict Properties with lMLP Low-Level Interface Source: https://context7.com/qcscine/parrot/llms.txt Demonstrates the direct usage of the lMLP class for predicting molecular properties, supporting periodic systems and QM/MM. It requires the 'numpy' and 'scine_parrot.lmlp' libraries and a model configuration file. ```python import numpy as np from scine_parrot.lmlp import lMLP # Initialize lMLP with a model configuration file lmlp = lMLP(generalization_setting_file='model_settings.ini') # Define molecular structure (positions in Bohr) elements = np.array(['C', 'H', 'H', 'H', 'H']) positions_bohr = np.array([ [0.0, 0.0, 0.0], [1.185, 1.185, 1.185], [-1.185, -1.185, 1.185], [-1.185, 1.185, -1.185], [1.185, -1.185, -1.185] ]) # Predict energy only energy = lmlp.predict(elements, positions_bohr, calc_forces=False) print(f"Energy: {energy} Hartree") # Output: Energy: -40.1234 Hartree ``` -------------------------------- ### Configure and Calculate with LmlpCalculator Source: https://context7.com/qcscine/parrot/llms.txt Shows how to use the LmlpCalculator to perform various molecular property calculations, including energy, gradients, Hessian, and thermochemistry. It supports custom model configurations and fallback to GFN2-xTB for atomic charges and bond orders. Requires 'scine_utilities' and 'numpy'. ```python import scine_utilities as utils import numpy as np # Load calculator via module manager module_manager = utils.core.ModuleManager.get_instance() calculator = module_manager.get('calculator', 'lmlp') # Read molecular structure from XYZ file structure, _ = utils.io.read('molecule.xyz') # Configure calculator calculator.structure = structure calculator.settings['molecular_charge'] = 0 calculator.settings['spin_multiplicity'] = 1 calculator.settings['method'] = '/path/to/custom/model.ini' # Optional: custom model # Calculate energy only calculator.set_required_properties([utils.Property.Energy]) results = calculator.calculate() print(f"Energy: {results.energy} Hartree") # Output: Energy: -1.1234567 Hartree # Calculate energy and gradients calculator.set_required_properties([utils.Property.Gradients]) results = calculator.calculate() print(f"Gradients shape: {results.gradients.shape}") # Output: Gradients shape: (N_atoms, 3) # Calculate Hessian and thermochemistry calculator.settings['temperature'] = 298.15 calculator.settings['pressure'] = 101325.0 calculator.settings['symmetry_number'] = 1 calculator.set_required_properties([utils.Property.Hessian]) results = calculator.calculate() print(f"Gibbs free energy: {results.thermochemistry.overall.gibbs_free_energy} Hartree") # Get atomic charges and bond orders (uses GFN2-xTB fallback) calculator.set_required_properties([utils.Property.AtomicCharges, utils.Property.BondOrderMatrix]) results = calculator.calculate() print(f"Charges: {results.atomic_charges}") print(f"C-H bond order: {results.bond_orders.get_order(0, 1)}") ``` -------------------------------- ### M3GNet Calculator for Inorganic Materials and Crystals Source: https://context7.com/qcscine/parrot/llms.txt This snippet demonstrates how to use the M3gnetCalculator to perform energy and gradient calculations for inorganic materials and crystals. It requires the scine_utilities library and loads a structure from a file, then sets the M3GNet model and calculates the energy and gradients. ```python import scine_utilities as utils module_manager = utils.core.ModuleManager.get_instance() calculator = module_manager.get('calculator', 'm3gnet') # Load structure structure, _ = utils.io.read('crystal.xyz') calculator.structure = structure # Select M3GNet model variant calculator.settings['method'] = 'm3gnet-mp-2021.2.8-pes' # Default PES model # calculator.settings['method'] = 'm3gnet-mp-2021.2.8-direct-pes' # Direct PES # Calculate calculator.set_required_properties([utils.Property.Energy, utils.Property.Gradients]) results = calculator.calculate() print(f"M3GNet Energy: {results.energy} Hartree") ``` -------------------------------- ### Reference for Available SCINE Parrot ML Potential Models Source: https://context7.com/qcscine/parrot/llms.txt This snippet provides a commented reference for all available Machine Learning (ML) potential models that can be accessed through SCINE Parrot. It lists models for Lifelong Machine Learning Potentials (LMLP), ANI, M3GNet, and MACE, along with their respective method families and model names. It also outlines the common calculator properties available from all models. ```python # Complete list of Model specifications for SCINE Parrot # Format: Model(method_family, model_name, "") # Lifelong Machine Learning Potentials # Model("lmlp", "", "") # ANI Neural Network Potentials (TorchANI) # Model("ani", "ani2x", "") # H, C, N, O, F, S, Cl - Most accurate # Model("ani", "ani1ccx", "") # H, C, N, O - CCSD(T) trained # Model("ani", "ani1x", "") # H, C, N, O - Original ANI # M3GNet Materials Potentials (MatGL) # Model("m3gnet", "m3gnet-mp-2021.2.8-pes", "") # Standard PES # Model("m3gnet", "m3gnet-mp-2021.2.8-direct-pes", "") # Direct PES # MACE Universal Potentials # Model("mace", "mace-mp_large", "") # Materials Project - High accuracy # Model("mace", "mace-mp_medium", "") # Materials Project - Balanced # Model("mace", "mace-mp_small", "") # Materials Project - Fast # Model("mace", "mace-off_large", "") # Organic molecules - High accuracy # Model("mace", "mace-off_medium", "") # Organic molecules - Balanced # Model("mace", "mace-off_small", "") # Organic molecules - Fast # Calculator properties available from all models: # - Energy (Hartree) # - Gradients (Hartree/Bohr) # - Hessian (via numerical differentiation) # - Thermochemistry (ZPE, enthalpy, entropy, Gibbs energy) # - AtomicCharges (via GFN2-xTB fallback) # - BondOrderMatrix (via GFN2-xTB fallback) ``` -------------------------------- ### Geometry Optimization with SCINE ReaDuct and ML Potentials Source: https://context7.com/qcscine/parrot/llms.txt This code illustrates the integration of SCINE Parrot calculators with SCINE ReaDuct for performing geometry optimizations. It sets up an initial structure, defines a dictionary of systems with a chosen calculator (e.g., 'lmlp', 'ani', 'mace', 'm3gnet'), and then runs the optimization task. The snippet includes cleanup of the output directory. ```python import scine_utilities as utils import scine_readuct as readuct import shutil module_manager = utils.core.ModuleManager.get_instance() # Set up initial structure structure, _ = utils.io.read('initial_guess.xyz') # Create systems dictionary with calculator systems = { 'guess': module_manager.get('calculator', 'lmlp'), # or 'ani', 'mace', 'm3gnet' } systems['guess'].structure = structure systems['guess'].settings['molecular_charge'] = 0 systems['guess'].settings['spin_multiplicity'] = 1 # Run geometry optimization systems, success = readuct.run_optimization_task( systems, ['guess'], output=['optimized'], stop_on_error=False, geoopt_coordinate_system='cartesianWithoutRotTrans', bfgs_trust_radius=0.3, convergence_max_iterations=500 ) if success: print("Optimization converged!") final_energy = systems['optimized'].results().energy print(f"Final energy: {final_energy} Hartree") # Clean up output directory shutil.rmtree('optimized', ignore_errors=True) ``` -------------------------------- ### Calculate Properties with MaceCalculator Source: https://context7.com/qcscine/parrot/llms.txt Interfaces with MACE foundation models using MaceCalculator in SCINE for accurate predictions across the periodic table. Supports energy, gradients, and full thermochemistry. ```python import scine_utilities as utils module_manager = utils.core.ModuleManager.get_instance() calculator = module_manager.get('calculator', 'mace') structure, _ = utils.io.read('any_molecule.xyz') calculator.structure = structure calculator.settings['molecular_charge'] = 0 calculator.settings['spin_multiplicity'] = 1 calculator.settings['method'] = 'mace-mp_medium' # Default, balanced calculator.set_required_properties([utils.Property.Gradients]) results = calculator.calculate() print(f"MACE Energy: {results.energy} Hartree") print(f"Max gradient component: {abs(results.gradients).max()}") ``` ```python calculator.settings['temperature'] = 298.15 calculator.settings['pressure'] = 101325.0 calculator.set_required_properties([utils.Property.Hessian]) results = calculator.calculate() print(f"ZPE: {results.thermochemistry.overall.zero_point_energy}") ``` -------------------------------- ### Calculate Properties with AniCalculator Source: https://context7.com/qcscine/parrot/llms.txt Utilizes the AniCalculator from SCINE to perform quantum mechanical calculations using ANI neural network potentials. Supports energy, gradients, and thermochemistry. ```python import scine_utilities as utils module_manager = utils.core.ModuleManager.get_instance() calculator = module_manager.get('calculator', 'ani') structure, _ = utils.io.read('organic_molecule.xyz') calculator.structure = structure calculator.settings['molecular_charge'] = 0 calculator.settings['spin_multiplicity'] = 1 calculator.settings['method'] = 'ani2x' # Default, most accurate calculator.set_required_properties([utils.Property.Energy, utils.Property.Gradients]) results = calculator.calculate() print(f"ANI-2x Energy: {results.energy} Hartree") print(f"Gradients: {results.gradients}") ``` ```python calculator.settings['temperature'] = 298.15 calculator.set_required_properties([utils.Property.Thermochemistry]) results = calculator.calculate() print(f"Enthalpy: {results.thermochemistry.overall.enthalpy}") print(f"Entropy: {results.thermochemistry.overall.entropy}") ``` -------------------------------- ### Predict Energy and Forces with lmlp Source: https://context7.com/qcscine/parrot/llms.txt Calculates energy and forces (gradients) for a given set of elements and positions using the lmlp model. Supports QM/MM calculations and uncertainty quantification. ```python energy, forces = lmlp.predict(elements, positions_bohr, calc_forces=True) print(f"Energy: {energy} Hartree") print(f"Forces shape: {forces.shape}") ``` ```python lattice_bohr = np.array([ [10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0] ]) energy, forces = lmlp.predict(elements, positions_bohr, lattice_Bohr=lattice_bohr) ``` ```python atomic_classes = np.array([1, 1, 1, 2, 2]) # 1=QM, 2=MM atomic_charges = np.array([0.0, 0.0, 0.0, 0.3, -0.3]) energy, forces = lmlp.predict( elements, positions_bohr, atomic_classes=atomic_classes, atomic_charges=atomic_charges ) ``` ```python lmlp_ensemble = lMLP( generalization_setting_file='ensemble_model.ini', uncertainty_scaling=2.0, uncertainty_thresholds=(30.0, 60.0, 180.0) # Energy, forces, env_forces ) energy, forces, energy_uncertainty, forces_uncertainty = lmlp_ensemble.predict( elements, positions_bohr, calc_uncertainty=True ) print(f"Energy uncertainty: {energy_uncertainty} Hartree") ``` ```python lmlp_al = lMLP( generalization_setting_file='ensemble_model.ini', active_learning_file='active_learning_data.dat', active_learning_thresholds=(3.0, 6.0, 18.0), active_learning_max_number=250, active_learning_min_step_difference=5 ) energy, forces, e_unc, f_unc = lmlp_al.predict(elements, positions_bohr, name='structure_001') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.