0
나는 molecule_group1에 주어진 분자들을 설정했고, 다른 함수들로 분자들을 다른 새로운 empty molecule_group2로 옮기고 싶다. 빈 분자 _ 그룹 2에 하나의 분자 만 추가합니다. 하나 이상의 분자가 들어있는 분자 그룹을 업로드 할 때마다 분자를 추가하지 않고 항상 "새 그룹에있는 분류 된 처음 5 개의 분자"를 인쇄합니다. 또한 분자가 내성 조건으로 인해 첨가되지 않는다면, 분자를 추가 할 때까지 어떻게 기능을 다시 작동시킬 수 있을까요?else if else if conditional loop in python
def initial_configurations(newemptygroup,backgroundmols,tolerance,boxspace):
p = PointRef(backgroundmols.molecule().evaluate().centerOfGeometry())
c = CloseMols(p,newemptygroup,5)
g_random = c.closeMolecules()
if len(g_random) == 0:
newemptygroup.add(backgroundmols)
print("first molecules to be added")
else:
g = sorted(g_random.items(), key=operator.itemgetter(1)) # sort the dict by value which give tuple
print("sorted first five molecules present in newgroup =%s" %g)
t = [x[0] for x in g]
selected = newemptygroup[t[0]].molecule().evaluate().centerOfGeometry()
for i in range(1,len(t)):
closemols = newemptygroup[t[i]].molecule().evaluate().centerOfGeometry()
if (selected-closemols).length() > tolerance:
newemptygroup.add(backgroundmols)
else:
print("not added")
return newemptygroup
추가하지 않았습니다. 여전히 같은 인쇄 메시지. –
적절한 내결함성이있는 요소가 없을 수 있습니까? –
예. 난수 생성기에 따라 분자를 배치합니다. –