Skip to content

Commit

Permalink
Run Simulation Function
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinAchondo committed Jun 3, 2024
1 parent fdd1d1a commit ad0c32d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion xppbe/Model/pbj_utils/pbj_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def calculate_potential_ens(self, atom_name = ["H"], mesh_dx = 1.0, mesh_length

def calculate_solvation_energy(self):
self.simulation.calculate_solvation_energy()
return self.simulation.solutes[0].results['solvation_energy']
return self.simulation.solutes[0].results['electrostatic_solvation_energy']
13 changes: 3 additions & 10 deletions xppbe/Scripts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@ function Allrun() {
fi

PYTHON_CODE="
import os
import sys
from xppbe import Simulation
import os,sys
from xppbe import RunSimulation
yaml_path = os.path.abspath(sys.argv[1])
results_path = '${results_path%/results}'
plot_pbj = '--pbj' in sys.argv
plot_mesh = '--mesh' in sys.argv
sim = Simulation(yaml_path, results_path=results_path)
sim.create_simulation()
sim.adapt_model()
sim.solve_model()
sim.postprocessing(mesh=plot_mesh, pbj=plot_pbj)
RunSimulation(yaml_path,results_path,(plot_mesh,plot_pbj))
"

sims_count=0
Expand Down Expand Up @@ -130,7 +124,6 @@ function SimsStatus() {
if [[ "$current_dir" == "$main_dir" ]]; then
sims_path="$main_dir/simulations_list"
results_path="$main_dir/results"
pbj_flag='--pbj'
fi

for arg in "$@"; do
Expand Down
9 changes: 9 additions & 0 deletions xppbe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
xppbe_path = os.path.dirname(os.path.abspath(__file__))
scripts_path = os.path.join(xppbe_path,'Scripts')


def RunSimulation(yaml_path,results_path,plot_flags):
plot_mesh,plot_pbj = plot_flags
sim = Simulation(yaml_path, results_path=results_path)
sim.create_simulation()
sim.adapt_model()
sim.solve_model()
sim.postprocessing(mesh=plot_mesh, pbj=plot_pbj)

def Allrun(sims_path, results_path, plot_mesh=False, plot_pbj=False):
sims_path = os.path.abspath(sims_path)
results_path = os.path.abspath(results_path)
Expand Down

0 comments on commit ad0c32d

Please sign in to comment.