Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating ShootPoint arguments #13

Merged
merged 2 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions aslm/core.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import os.path as op
import re
import subprocess

import numpy as np
# import pandas as pd

from .utils import log_run

Expand Down Expand Up @@ -58,12 +58,18 @@ def find_and_replace(line, substitutions):


class ShootingPoint:
def __init__(self):
self.name = None # Name of shooting point
def __init__(self, name, input_file, topology_file=None,
md_engine="AMBER"):
self.name = name # Name of shooting point
self.input_file = input_file # Path to input file (e.g., `init.in`)
self.topology_file = topology_file # Path to topology file
self.md_engine = md_engine
self._input_file_dir = op.dirname(op.abspath(self.input_file))
self._input_file_name = op.splitext(op.basename(self.input_file))[0]

self.forward_commit = None # Status of forward simulation
self.reverse_commit = None # Status of reverse simulation
self.result = None # Result of shooting point
self.path = None
self.cv_values = None
return

Expand All @@ -79,7 +85,7 @@ def run_forward(self, inputfile="fwd.in"):
"""
jobname = self.name + "_f"
logfile = self.name + "_f.log"
run_MD(inputfile, jobname, logfile, topology="system.prmtop",
run_MD(self.input_file, jobname, logfile, topology="system.prmtop",
engine="AMBER")
self.forward_commit = self.check_if_committed(logfile)
return
Expand Down
6 changes: 3 additions & 3 deletions aslm/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def test_read_cv_values():
test_file_loc = op.join(op.dirname(op.abspath(__file__)),
'test_data', 'COLVAR2')
sp = ShootingPoint()
sp = ShootingPoint(name='test', input_file='.')

sp._read_cv_values(test_file_loc)
test_values = sp.cv_values
Expand All @@ -29,7 +29,7 @@ def test_find_and_replace():


def test_check_if_commited():
sp = ShootingPoint()
sp = ShootingPoint(name='test', input_file='.')
test_file_loc = op.join(op.dirname(op.abspath(__file__)),
'test_data', 'commit.log')
test_result = sp.check_if_committed(test_file_loc)
Expand All @@ -43,7 +43,7 @@ def test_check_if_commited():


def test_log():
sp = ShootingPoint()
sp = ShootingPoint(name='test', input_file='.')
sp.name = 'test'
sp.cv_values = [1, 2, 3]
sp.result = 'accepted'
Expand Down