If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. If you are using the VPN, then SSH will work normally.

Commit ab92e3ab authored by eric pellegrini's avatar eric pellegrini

Merge tag '1.0.4.rc2' into develop

version 1.0.4.rc2
parents da5f5a9b 265827b9
Pipeline #1196 passed with stages
in 12 minutes and 10 seconds
......@@ -15,6 +15,7 @@ build:trusty:
- /^feature-.*$/
- /^release-.*$/
- /^hotfix-.*$/
- /^bugfix-.*$/
- develop
artifacts:
paths:
......@@ -34,6 +35,7 @@ test:trusty:
- /^feature-.*$/
- /^release-.*$/
- /^hotfix-.*$/
- /^bugfix-.*$/
- develop
dependencies:
- build:trusty
......@@ -68,6 +70,7 @@ build:osx:
- /^feature-.*$/
- /^release-.*$/
- /^hotfix-.*$/
- /^bugfix-.*$/
- develop
artifacts:
paths:
......@@ -87,6 +90,7 @@ test:osx:
- /^feature-.*$/
- /^release-.*$/
- /^hotfix-.*$/
- /^bugfix-.*$/
- develop
dependencies:
- build:osx
......@@ -123,6 +127,7 @@ build:windows:
- /^feature-.*$/
- /^release-.*$/
- /^hotfix-.*$/
- /^bugfix-.*$/
- develop
artifacts:
paths:
......@@ -144,6 +149,7 @@ test:windows:
- /^feature-.*$/
- /^release-.*$/
- /^hotfix-.*$/
- /^bugfix-.*$/
- develop
dependencies:
- build:windows
......
version 1.0.4.rc2
----------------
* added support for gitflow bugfix branch to gitlab config file
* the DL_POLY converter is now compliant with DL_POLY 4
* added the mass tolerance to LAMMP converter
* updated the LAMMP example trajectory with more accurate masses
version 1.0.4.rc1
----------------
* bug fix in IWidget: the label of the configurator was not taken into account
......
......@@ -18,19 +18,19 @@
Masses
1 14.007
2 12.
3 12.
4 15.999
5 1.008
6 1.008
7 14.007
8 12.011
9 12.011
10 15.999
11 12.011
12 1.008
13 1.008
1 14.0067
2 12.0107
3 12.0107
4 15.9994
5 1.00790
6 1.00790
7 14.0067
8 12.0107
9 12.0107
10 15.9994
11 12.0107
12 1.00790
13 1.00790
Pair Coeffs
......
......@@ -48,8 +48,8 @@ from MDANSE.Framework.Jobs.Converter import Converter
_HISTORY_FORMAT = {}
_HISTORY_FORMAT["2"] = {"rec1" : 81, "rec2" : 31, "reci" : 61, "recii" : 37, "reciii" : 37, "reciv" : 37, "reca" : 43, "recb" : 37, "recc" : 37, "recd" : 37}
_HISTORY_FORMAT["3"] = {"rec1" : 73, "rec2" : 31, "reci" : 73, "recii" : 37, "reciii" : 37, "reciv" : 37, "reca" : 55, "recb" : 37, "recc" : 37, "recd" : 37}
_HISTORY_FORMAT["4"] = {"rec1" : 73, "rec2" : 51, "reci" : 73, "recii" : 37, "reciii" : 37, "reciv" : 37, "reca" : 55, "recb" : 37, "recc" : 37, "recd" : 37}
_HISTORY_FORMAT["3"] = {"rec1" : 73, "rec2" : 73, "reci" : 73, "recii" : 73, "reciii" : 73, "reciv" : 73, "reca" : 73, "recb" : 73, "recc" : 73, "recd" : 73}
_HISTORY_FORMAT["4"] = {"rec1" : 73, "rec2" : 73, "reci" : 73, "recii" : 73, "reciii" : 73, "reciv" : 73, "reca" : 73, "recb" : 73, "recc" : 73, "recd" : 73}
class FieldFileError(Error):
pass
......@@ -184,18 +184,19 @@ class FieldFile(dict):
class HistoryFile(dict):
def __init__(self, filename, version="2"):
self['instance'] = open(filename, 'rb')
testLine = len(self['instance'].readline())
if testLine not in [81,82]:
if (testLine not in [81,82]) and (testLine not in [73,74]):
raise HistoryFileError('Invalid DLPOLY history file')
self['instance'].seek(0,0)
offset = testLine-81
self["version"] = version
offset = testLine - _HISTORY_FORMAT[self["version"]]["rec1"]
self._headerSize = _HISTORY_FORMAT[self["version"]]["rec1"] + _HISTORY_FORMAT[self["version"]]["rec2"] + 2*offset
......@@ -203,7 +204,7 @@ class HistoryFile(dict):
data = self['instance'].read(_HISTORY_FORMAT[self["version"]]["rec2"]+offset)
self["keytrj"], self["imcon"], self["natms"] = [int(v) for v in data.split()]
self["keytrj"], self["imcon"], self["natms"] = [int(v) for v in data.split()[0:3]]
if self["keytrj"] not in range(3):
raise HistoryFileError("Invalid value for trajectory output key.")
......@@ -233,10 +234,13 @@ class HistoryFile(dict):
self._maskStep = 3+3*(self["keytrj"]+1)+1
if (self["version"] == u'3') or (self["version"] == u'4'):
self._maskStep += 1
self['instance'].seek(0)
def read_step(self, step):
self['instance'].seek(self._headerSize+step*self._frameSize)
data = self['instance'].read(self._configHeaderSize).splitlines()
......@@ -260,9 +264,11 @@ class HistoryFile(dict):
mask[1::self._maskStep] = False
mask[2::self._maskStep] = False
mask[3::self._maskStep] = False
if (self["version"] == u'3') or (self["version"] == u'4'):
mask[4::self._maskStep] = False
config = numpy.array(numpy.compress(mask,data),dtype=numpy.float64)
config = numpy.reshape(config,(self["natms"],3*(self["keytrj"]+1)))
config[:,0:3] *= Units.Ang
......@@ -393,4 +399,4 @@ class DL_POLYConverter(Converter):
# Close the output trajectory.
self._trajectory.close()
REGISTRY['dl_poly'] = DL_POLYConverter
REGISTRY['dl_poly'] = DL_POLYConverter
\ No newline at end of file
......@@ -54,9 +54,11 @@ class LAMMPSTrajectoryFileError(Error):
class LAMMPSConfigFile(dict):
def __init__(self, filename):
def __init__(self, filename,tolerance):
self._filename = filename
self._tolerance = tolerance
self['n_bonds'] = None
......@@ -100,13 +102,16 @@ class LAMMPSConfigFile(dict):
for j in range(1, self["n_atom_types"]+1):
idx, mass = lines[i+j].strip().split()
tolerance = 1.0e-3
idx = int(idx)
mass = float(mass)
el = ELEMENTS.match_numeric_property("atomic_weight", mass, tolerance=tolerance)
if len(el) != 1:
raise LAMMPSConfigFileError("The atom %d with defined mass %f could not be assigned with a tolerance of %f. Please modify the mass in the config file to comply with MDANSE internal database" % (idx,mass,tolerance))
self["elements"][idx] = el[0]
el = ELEMENTS.match_numeric_property("atomic_weight", mass, tolerance=self._tolerance)
nElements = len(el)
if nElements == 0:
raise LAMMPSConfigFileError("The atom %d with defined mass %f could not be assigned with a tolerance of %f. Please modify the mass in the config file to comply with MDANSE internal database" % (idx,mass,self._tolerance))
elif nElements > 1:
raise LAMMPSConfigFileError("The atoms %s of MDANSE database matches the mass %f with a tolerance of %f. Please modify the mass in the config file to comply with MDANSE internal database" % (el,mass,self._tolerance))
else:
self["elements"][idx] = el[0]
m = re.match("^bonds$",line, re.I)
if m:
......@@ -132,6 +137,7 @@ class LAMMPSConverter(Converter):
'default':os.path.join('..','..','..','Data','Trajectories','LAMMPS','glycyl_L_alanine_charmm.config')})
settings['trajectory_file'] = ('input_file', {'label':"LAMMPS trajectory file",
'default':os.path.join('..','..','..','Data','Trajectories','LAMMPS','glycyl_L_alanine_charmm.lammps')})
settings['mass_tolerance'] = ('float', {'label':"mass tolerance (uma)", 'default':1.0e-5, 'mini':1.0e-9})
settings['time_step'] = ('float', {'label':"time step (fs)", 'default':1.0, 'mini':1.0e-9})
settings['n_steps'] = ('integer', {'label':"number of time steps", 'default':1, 'mini':0})
settings['output_file'] = ('output_files', {'formats':["netcdf"]})
......@@ -144,7 +150,7 @@ class LAMMPSConverter(Converter):
# The number of steps of the analysis.
self.numberOfSteps = self.configuration["n_steps"]["value"]
self._lammpsConfig = LAMMPSConfigFile(self.configuration["config_file"]["value"])
self._lammpsConfig = LAMMPSConfigFile(self.configuration["config_file"]["value"],self.configuration["mass_tolerance"]["value"])
self.parse_first_step()
......@@ -333,8 +339,8 @@ class LAMMPSConverter(Converter):
for i in range(self._nAtoms):
temp = self._lammps.readline().split()
idx = int(temp[self._id])-1
ty = temp[self._type]
name = "%s%s" % (self._lammpsConfig["elements"][ty],idx)
ty = int(temp[self._type])
name = "%s%d" % (self._lammpsConfig["elements"][ty],idx)
self._rankToName[i] = name
g.add_node(idx, element=self._lammpsConfig["elements"][ty], atomName=name)
......
__version__ = "1.0.4.rc1"
__version__ = "1.0.4.rc2"
__date__ = "22-11-2016"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment