# ruff: noqa
import pyframe

# Create MolecularSystem() object. Currently only PDB and fixed-format PQR files
# are supported (you can, however, give your own reader as an argument).
system = pyframe.MolecularSystem(input_file="acrolein_water.pdb")

# Extract fragment in pdb file marked by the ACR name and put it in core region.
core = system.get_fragments_by_name(names=["ACR"])
system.set_core_region(core, basis="pcseg-2")

# define the solvent as the fragments within 4 Angstrom of the core.
solvent = system.get_fragments_by_distance(reference=core, distance=4.0)

# Add solvent as a region, using standard potentials and solvent embedding potential (SEP)
system.add_region(name="solvent", fragments=solvent, use_standard_potentials=True, standard_potential_model="SEP")

# Create Project() object that is used to create embedding potentials and write input files.
project = pyframe.Project()

# This will start the fragment calculations using the using the auxiliary
# programs and settings defined when creating the regions.
project.create_embedding_potential(system)

# Write molecule file containing the core quantum region.
project.write_core(system)

# Write potential file containing all parameters of the embedding potential.
project.write_potential(system)
