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

Rework tests #131

Merged
merged 7 commits into from Dec 1, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 25 additions & 4 deletions pygromos/files/blocks/_general_blocks.py
@@ -1,5 +1,6 @@
from typing import Iterable, List
from numbers import Number
import copy

# FIELDS
class _generic_field():
Expand Down Expand Up @@ -146,15 +147,17 @@ def __init__(self, t: float=None, step: int=None, content=None, subcontent=False
if(t is None and step is None):
super().__init__(used=used, name=name, content=content)
elif(content is None):
super().__init__(used=used, name=name, content=[str(t)+"\t"+str(step)])
super().__init__(used=used, name=name, content=None)
self.t=t
self.step =step

self.subcontent = subcontent

def read_content_from_str(self, content:List[str]):
content = content[0].strip().split()
self.content = content
self.t = float(content[0])
self.step = float(content[1])
self.t = float(content[1])
self.step = float(content[0])

def block_to_string(self) -> str:
result = self.name + "\n"
Expand All @@ -167,16 +170,34 @@ class TITLE(_generic_gromos_block):
field_seperator:str = "\t"
line_seperator:str = "\n"
order = [[["content"]]]
pyGromosWatermark:str = "\t >>> Generated with PyGromosTools (riniker group) <<< "

def __init__(self, content:str, field_seperator:str="\t", line_seperator:str="\n", name="TITLE", used=True):
super().__init__(used=used, name=name, content=content)
self.field_seperator = field_seperator
self.line_seperator = line_seperator

def __deepcopy__(self, memo):
block = type(self)(content=None)
block.content = copy.deepcopy(self.content)
return block

def read_content_from_str(self, content:List[str]):
self.content = content
if type(content) == str:
self.content = [content]
else:
self.content = content

def block_to_string(self) -> str:
result = ""
result += str(self.name) + self.line_seperator
result += "".join(self.content)
if (self.pyGromosWatermark not in self.content):
result += self.line_seperator+self.pyGromosWatermark+self.line_seperator
result += "END" + self.line_seperator
return result

def block_to_string_old(self) -> str:
result = ""
result += str(self.name) + "\n"#double
result += "".join(self.content)
Expand Down
12 changes: 11 additions & 1 deletion pygromos/files/blocks/topology_blocks.py
@@ -1,4 +1,4 @@
import re
import re,copy
import __main__
from enum import Enum
from typing import Union, Iterable, Tuple, List, Dict
Expand Down Expand Up @@ -655,6 +655,16 @@ def __init__(self, NJLA: int=None, NPTB: int=None, STATEIDENTIFIERS:List[str]=[]
self.dummy_IAC = dummy_IAC
self.dummy_CHARGE = dummy_CHARGE

def __deepcopy__(self, memodict={}):
new_obj = type(self)()
new_obj.NJLA = copy.deepcopy(self.NJLA)
new_obj.NPTB = copy.deepcopy(self.NPTB)
new_obj.STATEIDENTIFIERS = copy.deepcopy(self.STATEIDENTIFIERS)
new_obj.STATEATOMHEADER = copy.deepcopy(self.STATEATOMHEADER)
new_obj.STATEATOMS = copy.deepcopy(self.STATEATOMS)
new_obj.dummy_IAC = copy.deepcopy(self.dummy_IAC)
new_obj.dummy_CHARGE = copy.deepcopy(self.dummy_CHARGE)
return new_obj

def read_content_from_str(self, content:List[str]):
field = 0
Expand Down
89,910 changes: 0 additions & 89,910 deletions pygromos/tests/in_testfiles/repdat/2_ligs_4E96_4J3I_sopt1_2_repdat.dat

Large diffs are not rendered by default.

150,015 changes: 0 additions & 150,015 deletions pygromos/tests/in_testfiles/repdat/in_REEDS_repdat1_long.dat

This file was deleted.

74,835 changes: 0 additions & 74,835 deletions pygromos/tests/in_testfiles/repdat/in_REEDS_repdat2_short.dat

Large diffs are not rendered by default.

60,017 changes: 0 additions & 60,017 deletions pygromos/tests/in_testfiles/repdat/in_REEDS_repdat3_dsidler_iter1_sopt.dat

This file was deleted.