Skip to content

Commit

Permalink
adding in_mol2 to amber
Browse files Browse the repository at this point in the history
  • Loading branch information
MTLehner committed Mar 18, 2022
1 parent a58de3f commit 51c602e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pygromos/files/forcefield/_generic_force_field.py
Expand Up @@ -28,11 +28,11 @@ def __init__(
if auto_import:
self.auto_import_ff()

def auto_import_ff(self):
def auto_import_ff(self, **kwargs):
raise NotImplementedError("This is a template class! It'should be used as a super class for all forcefields!")

def create_top(self, mol: str, in_top: Top = None) -> Top:
def create_top(self, mol: str, in_top: Top = None, **kwargs) -> Top:
raise NotImplementedError("This is a template class! It'should be used as a super class for all forcefields!")

def create_cnf(self, mol: str, in_cnf: Cnf = None) -> Cnf:
def create_cnf(self, mol: str, in_cnf: Cnf = None, **kwargs) -> Cnf:
raise NotImplementedError("This is a template class! It'should be used as a super class for all forcefields!")
17 changes: 14 additions & 3 deletions pygromos/files/forcefield/amber/amberff.py
Expand Up @@ -46,17 +46,28 @@ def auto_import_ff(self):
if not os.path.isfile(frcmod):
raise ImportError("could not find ff file " + frcmod)

def create_top(self, mol: str, in_top: Top = None) -> Top:
def create_top(self, mol: str, in_top: Top = None, in_mol2_file: str = None) -> Top:
self.mol = mol
self.in_mol2_file = in_mol2_file

if self.amber is None:
self.create_mol2()
if in_mol2_file is None:
self.create_mol2()
self.amber = amber2gromos(
in_mol2_file=self.in_mol2_file,
mol=self.mol,
forcefield=self.Forcefield,
gromosPP=self.gromosPP,
work_folder=self.work_folder,
)
self.top = Top(self.amber.get_gromos_topology())
if in_top is None:
self.top = Top(self.amber.get_gromos_topology())
elif isinstance(in_top, Top):
self.top = in_top + Top(self.amber.get_gromos_topology())
elif isinstance(in_top, str):
self.top = Top(in_top) + Top(self.amber.get_gromos_topology())
else:
raise TypeError("in_top is of wrong type")

def create_cnf(self, mol: str, in_cnf: Top = None) -> Cnf:
if self.amber is None:
Expand Down

0 comments on commit 51c602e

Please sign in to comment.